[LLVMbugs] [Bug 12895] New: Crash on invalid

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sun May 20 01:01:49 PDT 2012


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

             Bug #: 12895
           Summary: Crash on invalid
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: abramobagnara at tin.it
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified


$ cat q.cc
template <class A> struct Outer {
  template <class T, class U> struct Foo {};
  template <class T> struct Foo<int,void> {};
};

Outer<int>::Foo<int,void> f;

$ clang++ -c q.cc
q.cc:3:29: warning: class template partial specialization contains a template
      parameter that can not be deduced; this partial specialization will never
      be used
  template <class T> struct Foo<int,void> {};
                            ^~~~~~~~~~~~~
q.cc:3:19: note: non-deducible template parameter 'T'
  template <class T> struct Foo<int,void> {};
                  ^
clang:
/home/abramo/eclair_swi/deps/build/llvm-r156159/tools/clang/lib/AST/Type.cpp:1858:
clang::TemplateSpecializationType::TemplateSpecializationType(clang::TemplateName,
const clang::TemplateArgument*, unsigned int, clang::QualType,
clang::QualType): Assertion `(!Canon.isNull() || T.isDependent() ||
anyDependentTemplateArguments(Args, NumArgs, InstantiationDependent)) && "No
canonical type for non-dependent class template specialization"' failed.
0  clang     0x000000000274cee1
1  clang     0x000000000274ccdd
2  libc.so.6 0x00007f624d8274c0
3  libc.so.6 0x00007f624d827445 gsignal + 53
4  libc.so.6 0x00007f624d82abab abort + 379
5  libc.so.6 0x00007f624d82010e
6  libc.so.6 0x00007f624d8201b2
7  clang     0x0000000001b80a51
clang::TemplateSpecializationType::TemplateSpecializationType(clang::TemplateName,
clang::TemplateArgument const*, unsigned int, clang::QualType, clang::QualType)
+ 629
8  clang     0x0000000001a2187f
clang::ASTContext::getCanonicalTemplateSpecializationType(clang::TemplateName,
clang::TemplateArgument const*, unsigned int) const + 661
9  clang     0x0000000001a214c7
clang::ASTContext::getTemplateSpecializationType(clang::TemplateName,
clang::TemplateArgument const*, unsigned int, clang::QualType) const + 437
10 clang     0x0000000001399402
clang::TemplateDeclInstantiator::InstantiateClassTemplatePartialSpecialization(clang::ClassTemplateDecl*,
clang::ClassTemplatePartialSpecializationDecl*) + 532
11 clang     0x0000000001394a9b
clang::TemplateDeclInstantiator::VisitClassTemplatePartialSpecializationDecl(clang::ClassTemplatePartialSpecializationDecl*)
+ 205
12 clang     0x000000000138b78b
13 clang     0x0000000001361a6a
clang::Sema::InstantiateClass(clang::SourceLocation, clang::CXXRecordDecl*,
clang::CXXRecordDecl*, clang::MultiLevelTemplateArgumentList const&,
clang::TemplateSpecializationKind, bool) + 1070
14 clang     0x0000000001362d8e
clang::Sema::InstantiateClassTemplateSpecialization(clang::SourceLocation,
clang::ClassTemplateSpecializationDecl*, clang::TemplateSpecializationKind,
bool) + 1934
15 clang     0x00000000013d7aa6
clang::Sema::RequireCompleteType(clang::SourceLocation, clang::QualType,
clang::PartialDiagnostic const&, std::pair<clang::SourceLocation,
clang::PartialDiagnostic>) + 1058
16 clang     0x00000000013d7e55
clang::Sema::RequireCompleteType(clang::SourceLocation, clang::QualType,
clang::PartialDiagnostic const&) + 111
17 clang     0x000000000103fb87
clang::Sema::RequireCompleteDeclContext(clang::CXXScopeSpec&,
clang::DeclContext*) + 401
18 clang     0x00000000012bc8ca
clang::Sema::LookupTemplateName(clang::LookupResult&, clang::Scope*,
clang::CXXScopeSpec&, clang::QualType, bool, bool&) + 450
19 clang     0x00000000012bc250 clang::Sema::isTemplateName(clang::Scope*,
clang::CXXScopeSpec&, bool, clang::UnqualifiedId&,
clang::OpaquePtr<clang::QualType>, bool,
clang::OpaquePtr<clang::TemplateName>&, bool&) + 466
20 clang     0x0000000000fe22ac
clang::Parser::ParseOptionalCXXScopeSpecifier(clang::CXXScopeSpec&,
clang::OpaquePtr<clang::QualType>, bool, bool*, bool) + 3952
21 clang     0x0000000000faca2d clang::Parser::TryAnnotateCXXScopeToken(bool) +
313
22 clang     0x0000000000fbbbae
clang::Parser::ParseDeclarationSpecifiers(clang::DeclSpec&,
clang::Parser::ParsedTemplateInfo const&, clang::AccessSpecifier,
clang::Parser::DeclSpecContext,
llvm::SmallVector<clang::Parser::LateParsedAttribute*, 2u>*) + 3068
23 clang     0x0000000000faa248
clang::Parser::ParseDeclarationOrFunctionDefinition(clang::Parser::ParsingDeclSpec&,
clang::AccessSpecifier) + 94
24 clang     0x0000000000faa66f
clang::Parser::ParseDeclarationOrFunctionDefinition(clang::ParsedAttributes&,
clang::AccessSpecifier) + 135
25 clang     0x0000000000fa9dfd
clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&,
clang::Parser::ParsingDeclSpec*) + 2775
26 clang     0x0000000000fa924c
clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&) + 410
27 clang     0x0000000000fa5ae0 clang::ParseAST(clang::Sema&, bool, bool) + 476
28 clang     0x0000000000c4ccb6 clang::ASTFrontendAction::ExecuteAction() + 298
29 clang     0x0000000000dec8e4 clang::CodeGenAction::ExecuteAction() + 1194
30 clang     0x0000000000c4c8b7 clang::FrontendAction::Execute() + 249
31 clang     0x0000000000c24d40
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 718
32 clang     0x0000000000bf4a0c
clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 969
33 clang     0x0000000000be09d3 cc1_main(char const**, char const**, char
const*, void*) + 999
34 clang     0x0000000000bef6fa main + 494
35 libc.so.6 0x00007f624d81276d __libc_start_main + 237
36 clang     0x0000000000bdfad9
Stack dump:
0.    Program arguments: /home/abramo/eclair_swi/deps/bin/clang -cc1 -triple
x86_64-unknown-linux-gnu -emit-obj -mrelax-all -disable-free -main-file-name
q.cc -mrelocation-model static -mdisable-fp-elim -fmath-errno -masm-verbose
-mconstructor-aliases -munwind-tables -target-cpu x86-64 -target-linker-version
2.22 -momit-leaf-frame-pointer -coverage-file q.o -resource-dir
/home/abramo/eclair_swi/deps/bin/../lib/clang/3.2 -fmodule-cache-path
/var/tmp/clang-module-cache -internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../../include/c++/4.6 -internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../../include/c++/4.6/x86_64-linux-gnu
-internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../../include/c++/4.6/backward
-internal-isystem /usr/local/include -internal-isystem
/home/abramo/eclair_swi/deps/bin/../lib/clang/3.2/include
-internal-externc-isystem /usr/include/x86_64-linux-gnu
-internal-externc-isystem /include -internal-externc-isystem /usr/include
-fdeprecated-macro -fdebug-compilation-dir /home/abramo -ferror-limit 19
-fmessage-length 80 -mstackrealign -fgnu-runtime -fobjc-runtime-has-arc
-fobjc-runtime-has-weak -fobjc-fragile-abi -fcxx-exceptions -fexceptions
-fdiagnostics-show-option -fcolor-diagnostics -o q.o -x c++ q.cc 
1.    q.cc:6:13: current parser token 'Foo'
clang: error: unable to execute command: Aborted (core dumped)
clang: error: clang frontend command failed due to signal (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) and associated run
script(s) are located at:
clang: note: diagnostic msg: /tmp/q-dzbtRt.ii
clang: note: diagnostic msg: /tmp/q-dzbtRt.sh

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