[LLVMbugs] [Bug 9545] New: Don't cause deduction failure for mismatch against function parameter not having deducible template parameters

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Mar 24 14:34:54 PDT 2011


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: unassignedclangbugs at nondot.org
        ReportedBy: schaub.johannes at googlemail.com
                CC: llvmbugs at cs.uiuc.edu, dgregor at apple.com


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.



More information about the llvm-bugs mailing list