http://llvm.org/bugs/show_bug.cgi?id=9545

           Summary: Don't cause deduction failure for mismatch against
                    function parameter not having deducible template
                    parameters
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
        AssignedTo: [email protected]
        ReportedBy: [email protected]
                CC: [email protected], [email protected]


The handling of non-deduced contexts with regard to how they influence
deduction failure has been clarified now. 

The intent is: After a mismatch against a parameter, if the parameter contains
no template parameters in deduced contexts, all implicit conversions are
allowed. 

The following should therefor be well-formed:

    template<typename T> 
    struct identity {
      typedef T type;
    };

    template<typename T>
    void f(T, typename identity<T>::type*);

    int main() {
      // 0 -> int* OK
      f(0, 0);
    }

Notably also for cases where a compound type causes mismatch for compounded
types, as in:

    struct A {
      void f(int);

      void g(int);
      void g(float);
    };

    struct B : A { 
      typedef int type; 
    };

    // B != A, but bridged by implicit conversion
    template<typename T>
    void f(T, void(B::*)(typename T::type));

    // same - implicit conversion resolves
    // overload set &A::g.
    template<typename T>
    void g(T, void(B::*)(typename T::type));

    int main() {
      B b;
      f(b, &A::f);
      g(b, &A::g);
    }

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to