[LLVMbugs] [Bug 5559] New: Problems with nested templates

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Thu Nov 19 03:05:51 PST 2009


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

           Summary: Problems with nested templates
           Product: clang
           Version: trunk
          Platform: All
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: parser
        AssignedTo: dgregor at apple.com
        ReportedBy: ggreif at gmail.com
                CC: llvmbugs at cs.uiuc.edu


Created an attachment (id=3837)
 --> (http://llvm.org/bugs/attachment.cgi?id=3837)
Testcase plus errors

Please see attached file. I have distilled this from error messages I got for
http://micker.googlecode.com

Here I reproduce the code:

-------------------------------------------------------------
// file: FooBar.hpp
// invokation: clang -x c++ -c FooBar.hpp -o /dev/null

template <typename T>
struct Foo;

template <>
struct Foo<int>
{
    template <typename U>
    struct Bar
    {};
};

template <>
template <>
struct Foo<int>::Bar<void>
{};


template <typename FT,
          typename FT::template Bar<int>::Quux QUUX>
struct Baz;
------------------------------------------------------

/*
clang --version
clang version 1.1 (trunk 89084)
Target: x86_64-unknown-linux-gnu
Thread model: posix


I get these errors:

FooBar.hpp:12:1: error: extraneous template parameter list in template
specialization or out-of-line template definition
template <>
^~~~~~~~~~~
FooBar.hpp:19:20: error: declaration of 'FT' shadows template parameter
          typename FT::template Bar<int>::Quux QUUX>
                   ^
FooBar.hpp:18:20: note: template parameter is declared here
template <typename FT,
                   ^
FooBar.hpp:19:40: error: expected unqualified-id
          typename FT::template Bar<int>::Quux QUUX>
                                       ^
4 diagnostics generated.
80001b614af1c567clang: error: unable to remove file: not a file or directory

^^^^^^^^^^^^^^^^ please note this strange output!!

g++ (v3.4.6) does compile this without problems.

*/


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