[LLVMbugs] [Bug 9476] New: clang++ asserts while parsing broken/strange top level declaration

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sun Mar 13 01:43:31 PST 2011


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

           Summary: clang++ asserts while parsing broken/strange top level
                    declaration
           Product: clang
           Version: trunk
          Platform: Macintosh
        OS/Version: MacOS X
            Status: NEW
          Severity: normal
          Priority: P
         Component: Frontend
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: david.majnemer at gmail.com
                CC: llvmbugs at cs.uiuc.edu


The following code *should not* compile, "fcn<B<0> >()" is not in a function
block; it, however, does make clang assert.

$ cat clangbug2.cc       
template <typename T>
static int
fcn()
{
    return sizeof(T);
}

template <typename T>
struct A {};

template <int I>
struct B : A<B<I> > {};

fcn<B<0> >();
$ clang++ --version      
clang version 3.0 (trunk 127564)
Target: x86_64-apple-darwin10
Thread model: posix
$ clang++ clangbug2.cc -c                                                  
clangbug2.cc:14:1: error: C++ requires a type specifier for all declarations
fcn<B<0> >();
^~~
clangbug2.cc:14:1: error: template specialization requires 'template<>'
fcn<B<0> >();
^  ~~~~~~~
template<> 
Assertion failed: (Linkage(CachedLinkage) == getLVForDecl(this,
LVFlags::CreateOnlyDeclLinkage()).linkage()), function getLinkage, file
Decl.cpp, line 652.

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