[LLVMbugs] [Bug 13395] New: Crash on invalid: class C {template<> friend class C; };

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Jul 18 19:11:23 PDT 2012


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

             Bug #: 13395
           Summary: Crash on invalid: class C {template<> friend class
                    C;};
           Product: clang
           Version: 3.0
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: andersk at mit.edu
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified


clang++ 3.0-6ubuntu3 crashes on this input:

class C {template<> friend class C;};

with the following output:

$ clang++ -c test.cc
test.cc:1:10: error: extraneous 'template<>' in declaration of class 'C'
class C {template<> friend class C;};
         ^
0  libLLVM-3.0.so.1 0x00007faaf43c5d1f
1  libLLVM-3.0.so.1 0x00007faaf43c6189
2  libpthread.so.0  0x00007faaf3367cb0
3  clang            0x0000000000d443f0 clang::NestedNameSpecifier::getKind()
const + 0
4  clang            0x0000000000d4456c
clang::NestedNameSpecifier::containsUnexpandedParameterPack() const + 12
5  clang            0x0000000000cbe40f
clang::ASTContext::getDependentNameType(clang::ElaboratedTypeKeyword,
clang::NestedNameSpecifier*, clang::IdentifierInfo const*, clang::QualType)
const + 319
6  clang            0x00000000009e58ad
clang::Sema::CheckTypenameType(clang::ElaboratedTypeKeyword,
clang::SourceLocation, clang::NestedNameSpecifierLoc, clang::IdentifierInfo
const&, clang::SourceLocation) + 1453
7  clang            0x00000000008e10c9
clang::Sema::ActOnTemplatedFriendTag(clang::Scope*, clang::SourceLocation,
unsigned int, clang::SourceLocation, clang::CXXScopeSpec&,
clang::IdentifierInfo*, clang::SourceLocation, clang::AttributeList*,
clang::ASTMultiPtr<clang::TemplateParameterList*>) + 809
8  clang            0x0000000000809a40
clang::Parser::ParseClassSpecifier(clang::tok::TokenKind,
clang::SourceLocation, clang::DeclSpec&, clang::Parser::ParsedTemplateInfo
const&, clang::AccessSpecifier, bool) + 6112
9  clang            0x00000000007f78f1
clang::Parser::ParseDeclarationSpecifiers(clang::DeclSpec&,
clang::Parser::ParsedTemplateInfo const&, clang::AccessSpecifier,
clang::Parser::DeclSpecContext) + 593
10 clang            0x0000000000804eee
clang::Parser::ParseCXXClassMemberDeclaration(clang::AccessSpecifier,
clang::AttributeList*, clang::Parser::ParsedTemplateInfo const&,
clang::Parser::ParsingDeclRAIIObject*) + 862
11 clang            0x00000000007d4eb2
clang::Parser::ParseSingleDeclarationAfterTemplate(unsigned int,
clang::Parser::ParsedTemplateInfo const&,
clang::Parser::ParsingDeclRAIIObject&, clang::SourceLocation&,
clang::AccessSpecifier, clang::AttributeList*) + 3250
12 clang            0x00000000007d7c70
clang::Parser::ParseTemplateDeclarationOrSpecialization(unsigned int,
clang::SourceLocation&, clang::AccessSpecifier, clang::AttributeList*) + 608
13 clang            0x00000000007d86a7
clang::Parser::ParseDeclarationStartingWithTemplate(unsigned int,
clang::SourceLocation&, clang::AccessSpecifier, clang::AttributeList*) + 103
14 clang            0x0000000000805f49
clang::Parser::ParseCXXClassMemberDeclaration(clang::AccessSpecifier,
clang::AttributeList*, clang::Parser::ParsedTemplateInfo const&,
clang::Parser::ParsingDeclRAIIObject*) + 5049
15 clang            0x0000000000807b9f
clang::Parser::ParseCXXMemberSpecification(clang::SourceLocation, unsigned int,
clang::Decl*) + 1855
16 clang            0x0000000000808f2b
clang::Parser::ParseClassSpecifier(clang::tok::TokenKind,
clang::SourceLocation, clang::DeclSpec&, clang::Parser::ParsedTemplateInfo
const&, clang::AccessSpecifier, bool) + 3275
17 clang            0x00000000007f78f1
clang::Parser::ParseDeclarationSpecifiers(clang::DeclSpec&,
clang::Parser::ParsedTemplateInfo const&, clang::AccessSpecifier,
clang::Parser::DeclSpecContext) + 593
18 clang            0x00000000007e2c39
clang::Parser::ParseDeclarationOrFunctionDefinition(clang::Parser::ParsingDeclSpec&,
clang::AccessSpecifier) + 89
19 clang            0x00000000007e32e6
clang::Parser::ParseDeclarationOrFunctionDefinition(clang::ParsedAttributes&,
clang::AccessSpecifier) + 678
20 clang            0x00000000007e4ead
clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&,
clang::Parser::ParsingDeclSpec*) + 2685
21 clang            0x00000000007e5417
clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&) + 167
22 clang            0x00000000007bcbfd clang::ParseAST(clang::Sema&, bool) +
269
23 clang            0x00000000006a6253 clang::CodeGenAction::ExecuteAction() +
51
24 clang            0x00000000005adc7f
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 319
25 clang            0x000000000059653a
clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 1114
26 clang            0x000000000058e1c4 cc1_main(char const**, char const**,
char const*, void*) + 820
27 clang            0x000000000058cb3c main + 620
28 libc.so.6        0x00007faaf2aa176d __libc_start_main + 237
29 clang            0x000000000058dd39
Stack dump:
0.    Program arguments: /usr/bin/clang -cc1 -triple x86_64-pc-linux-gnu
-emit-obj -mrelax-all -disable-free -disable-llvm-verifier -main-file-name
test.cc -mrelocation-model static -mdisable-fp-elim -masm-verbose
-mconstructor-aliases -munwind-tables -target-cpu x86-64 -target-linker-version
2.22 -momit-leaf-frame-pointer -coverage-file test.o -resource-dir
/usr/bin/../lib/clang/3.0 -fmodule-cache-path /var/tmp/clang-module-cache
-internal-isystem /usr/include/c++/4.6 -internal-isystem
/usr/include/c++/4.6/x86_64-linux-gnu -internal-isystem
/usr/include/c++/4.6/backward -internal-isystem /usr/local/include
-internal-isystem /usr/bin/../lib/clang/3.0/include -internal-externc-isystem
/usr/include/x86_64-linux-gnu -internal-externc-isystem /usr/include
-fdeprecated-macro -ferror-limit 19 -fmessage-length 80 -fgnu-runtime
-fobjc-runtime-has-arc -fobjc-runtime-has-weak -fobjc-fragile-abi
-fcxx-exceptions -fexceptions -fdiagnostics-show-option -fcolor-diagnostics -o
test.o -x c++ test.cc 
1.    test.cc:1:35: current parser token ';'
2.    test.cc:1:1: parsing struct/union/class body 'C'
clang: error: unable to execute command: Segmentation fault (core dumped)
clang: error: clang frontend command failed due to signal 2 (use -v to see
invocation)
clang: note: diagnostic msg: Please submit a bug report to
http://llvm.org/bugs/ and include command line arguments and all diagnostic
information.
clang: note: diagnostic msg: Preprocessed source(s) are located at:
clang: note: diagnostic msg: /tmp/test-aZMvZI.ii

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