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

             Bug #: 12776
           Summary: Incorrect compile error for local class in
                    out-of-class member function
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++
        AssignedTo: [email protected]
        ReportedBy: [email protected]
                CC: [email protected], [email protected]
    Classification: Unclassified


This code should compile without any errors:

template<class T>
class SomeType
{
};

template<class T>
class Test
{
public:
    Test();
};

template<class T>
Test<T>::Test()
{
    class Local
    {
    public:
        Local()
        {
            typedef SomeType<T> MyType;
        }
    };
    Local instance;
}


int main(int argc, const char **argv)
{
    Test<int> test;

    return 0;
}


However, clang produces the following compile error:

main.cpp:21:30: error: template argument for template type parameter must be a
type
            typedef SomeType<T> MyType;
                             ^
main.cpp:30:15: note: in instantiation of member function 'Test<int>::Test'
requested here
    Test<int> test;
              ^
main.cpp:1:16: note: template parameter is declared here
template<class T>
               ^
1 error generated.


This happens for clang version 3.1 trunk (svn revision 156484).  It also
happens for clang 3.0.

This code compiles fine if the class named "Local" is not local *or* if the
member function is not defined out-of-class.  However, in the latter case
compilation fails with a similar error when using clang 3.0.

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