[LLVMbugs] [Bug 15013] New: Compilation problem using function pointer as non-type template parameter

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sun Jan 20 15:12:23 PST 2013


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

             Bug #: 15013
           Summary: Compilation problem using function pointer as non-type
                    template parameter
           Product: clang
           Version: 3.2
          Platform: PC
        OS/Version: MacOS X
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: hartmut.kaiser at gmail.com
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified


This code fails to compile:

template <typename A, void (A::*F)()>
struct T {};

struct foo
{
    void bar() const {}
    typedef T<foo const, &foo::bar> bar_type;
};

int main()
{
    return 0;
}

even if it should (and it compiles with gcc, VC, comeau).

The generated error is:

test.cpp:7:22: error: non-type template argument of type 'void (foo::*)()
const' cannot be converted to a value of type 'void (const foo::*)()'
typedef T<foo const, &foo::bar> bar_type;
                     ^~~~~~~~~
test.cpp:1:33: note: template parameter is declared here
template <typename A, void (A::*F)()>

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