[LLVMbugs] [Bug 7282] New: C++ nested template bug

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Jun 2 05:38:43 PDT 2010


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

           Summary: C++ nested template bug
           Product: clang
           Version: 2.7
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: release blocker
          Priority: P
         Component: C++
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: antoinep92 at gmail.com
                CC: llvmbugs at cs.uiuc.edu, dgregor at apple.com


Created an attachment (id=4963)
 --> (http://llvm.org/bugs/attachment.cgi?id=4963)
Minimal fail case

Clang is unable to perform argument matching for function call inside nested
template methods.

*** Minimal code demonstrating the problem (see main.cpp attached):
template<int i> struct T {};
template<class TA> struct A {
    template<class TB> struct B {
        template<int i> static void f(T<i>*) {
            std::cout << i;
        }
    };
};

*** Clang output:
main.cpp:14:2: error: no matching function for call to 'f'
        A<int>::B<bool>::f((T<1>*)0);
        ^~~~~~~~~~~~~~~~~~
main.cpp:6:31: note: candidate template ignored: failed template argument
deduction
                template<int i> static void f(T<i>*) {

*** Comments:
- If class A or B is made non-template it compiles.
- The code compiles with llvm-gcc (ie gcc 4.2), gcc 4.4 and msvc
- I'm pretty sure the code is standard compilant, but don't have proof.
- The minimal code doesn't make much sense, but I created it by reducing a 2k+
line file to pinpoint the problem.

-- 
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