[LLVMbugs] [Bug 13901] New: Can't declare member function with "F foo; " with F as function type if F is a template parameter

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sat Sep 22 14:33:40 PDT 2012


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

             Bug #: 13901
           Summary: Can't declare member function with "F foo;" with F as
                    function type if F is a template parameter
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: eric at boostpro.com
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified


OK, I confess that I honestly don't know if this is a legitimate bug or not.
Every compiler I've tried rejects it. But it just seems like it *should* work.

template<typename F>
struct S
{
    typedef int G(int);
    G bar; // OK, bar is declared as a member function

    F foo; // whoops, can't declare member function this way
};

int main()
{
    S<int(int)> s;
    s.bar(1);
    s.foo(1);
}

Why should the fact that F is a template parameter make any difference? A type
is a type, right?

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