The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
29.39k
stars
12.15k
forks
source link
Assertion failes in SFINAE expression: Unable to find instantiation of declaration! #8782
Closed
llvmbot closed 14 years ago
Extended Description
Compiling the given sample code using a clang build from trunk causes clang to crash with a failed exception.
I think, that the code is valid, but I am not absolutely sure. gcc does compile the example.
If I reorder the code a bit and put the definition of Bar above the initial definition of Foo, clang compiles the code, too.
clang sample.cpp
clang: SemaTemplateInstantiateDecl.cpp:2752: clang::NamedDecl clang::Sema::FindInstantiatedDecl(clang::SourceLocation, clang::NamedDecl, const clang::MultiLevelTemplateArgumentList&): Assertion `(Result || isa(D) || D->isInvalidDecl() || cast(ParentDC)->isInvalidDecl()) && "Unable to find instantiation of declaration!"' failed.
0 clang 0x000000000215e289
1 clang 0x000000000215e07c
2 libpthread.so.0 0x00007fcd2d01f8f0
3 libc.so.6 0x00007fcd2c30ea75 gsignal + 53
4 libc.so.6 0x00007fcd2c3125c0 abort + 384
5 libc.so.6 0x00007fcd2c307941 assert_fail + 241
6 clang 0x00000000013c972a clang::Sema::FindInstantiatedDecl(clang::SourceLocation, clang::NamedDecl, clang::MultiLevelTemplateArgumentList const&) + 1820
7 clang 0x00000000013a1525
8 clang 0x00000000013ab99e
9 clang 0x00000000013a5f81
10 clang 0x00000000013a5844
11 clang 0x00000000013a5982
12 clang 0x00000000013a795d
13 clang 0x00000000013abcf7
14 clang 0x00000000013a5ffb
15 clang 0x00000000013a5844
16 clang 0x00000000013a8371
17 clang 0x00000000013a478f clang::Sema::Subst(clang::TemplateArgumentLoc const&, clang::TemplateArgumentLoc&, clang::MultiLevelTemplateArgumentList const&) + 105
18 clang 0x00000000013c68d8
19 clang 0x00000000013c31c0
20 clang 0x00000000013c9ce9
21 clang 0x00000000013c6610 clang::Sema::SubstDecl(clang::Decl, clang::DeclContext, clang::MultiLevelTemplateArgumentList const&) + 94
22 clang 0x00000000013a3366 clang::Sema::InstantiateClass(clang::SourceLocation, clang::CXXRecordDecl, clang::CXXRecordDecl, clang::MultiLevelTemplateArgumentList const&, clang::TemplateSpecializationKind, bool) + 1184
23 clang 0x00000000013a3d18 clang::Sema::InstantiateClassTemplateSpecialization(clang::SourceLocation, clang::ClassTemplateSpecializationDecl, clang::TemplateSpecializationKind, bool) + 1900
24 clang 0x00000000013d3b41 clang::Sema::RequireCompleteType(clang::SourceLocation, clang::QualType, clang::PartialDiagnostic const&, std::pair<clang::SourceLocation, clang::PartialDiagnostic>) + 317
25 clang 0x00000000013d3ef2 clang::Sema::RequireCompleteType(clang::SourceLocation, clang::QualType, clang::PartialDiagnostic const&) + 122
26 clang 0x0000000001207599 clang::Sema::RequireCompleteDeclContext(clang::CXXScopeSpec&, clang::DeclContext) + 357
27 clang 0x0000000001207df4 clang::Sema::BuildCXXNestedNameSpecifier(clang::Scope, clang::CXXScopeSpec&, clang::SourceLocation, clang::SourceLocation, clang::IdentifierInfo&, clang::QualType, clang::NamedDecl, bool, bool) + 468
28 clang 0x0000000001208af5 clang::Sema::ActOnCXXNestedNameSpecifier(clang::Scope, clang::CXXScopeSpec&, clang::SourceLocation, clang::SourceLocation, clang::IdentifierInfo&, clang::OpaquePtr, bool) + 121
29 clang 0x00000000011d838b clang::Parser::ParseOptionalCXXScopeSpecifier(clang::CXXScopeSpec&, clang::OpaquePtr, bool, bool) + 3303
30 clang 0x00000000011b65e8 clang::Parser::TryAnnotateTypeOrScopeToken(bool) + 304
31 clang 0x00000000011bebdd clang::Parser::ParseDeclarationSpecifiers(clang::DeclSpec&, clang::Parser::ParsedTemplateInfo const&, clang::AccessSpecifier, clang::Parser::DeclSpecContext) + 6255
32 clang 0x00000000011cc405 clang::Parser::ParseCXXClassMemberDeclaration(clang::AccessSpecifier, clang::Parser::ParsedTemplateInfo const&, clang::Parser::ParsingDeclRAIIObject) + 1749
33 clang 0x00000000011cd473 clang::Parser::ParseCXXMemberSpecification(clang::SourceLocation, unsigned int, clang::Decl) + 1371
34 clang 0x00000000011cb44e clang::Parser::ParseClassSpecifier(clang::tok::TokenKind, clang::SourceLocation, clang::DeclSpec&, clang::Parser::ParsedTemplateInfo const&, clang::AccessSpecifier, bool) + 5474
35 clang 0x00000000011beac8 clang::Parser::ParseDeclarationSpecifiers(clang::DeclSpec&, clang::Parser::ParsedTemplateInfo const&, clang::AccessSpecifier, clang::Parser::DeclSpecContext) + 5978
36 clang 0x00000000011e1612 clang::Parser::ParseSingleDeclarationAfterTemplate(unsigned int, clang::Parser::ParsedTemplateInfo const&, clang::Parser::ParsingDeclRAIIObject&, clang::SourceLocation&, clang::AccessSpecifier) + 364
37 clang 0x00000000011e1458 clang::Parser::ParseTemplateDeclarationOrSpecialization(unsigned int, clang::SourceLocation&, clang::AccessSpecifier) + 990
38 clang 0x00000000011e0fe3 clang::Parser::ParseDeclarationStartingWithTemplate(unsigned int, clang::SourceLocation&, clang::AccessSpecifier) + 175
39 clang 0x00000000011bb6eb clang::Parser::ParseDeclaration(clang::ASTOwningVector<clang::Stmt, 32u>&, unsigned int, clang::SourceLocation&, clang::CXX0XAttributeList) + 251
40 clang 0x00000000011b4e8b clang::Parser::ParseExternalDeclaration(clang::CXX0XAttributeList, clang::Parser::ParsingDeclSpec) + 1305
41 clang 0x00000000011b48e3 clang::Parser::ParseTopLevelDecl(clang::OpaquePtr&) + 343
42 clang 0x000000000119e4ac clang::ParseAST(clang::Sema&, bool) + 328
43 clang 0x0000000000f15d91 clang::ASTFrontendAction::ExecuteAction() + 263
44 clang 0x0000000001039c84 clang::CodeGenAction::ExecuteAction() + 988
45 clang 0x0000000000f159dc clang::FrontendAction::Execute() + 320
46 clang 0x0000000000eff63d clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 751
47 clang 0x0000000000eb27d8 clang::ExecuteCompilerInvocation(clang::CompilerInstance ) + 856
48 clang 0x0000000000ea5bdf cc1_main(char const, char const, char const, void) + 958
49 clang 0x0000000000eae962 main + 499
50 libc.so.6 0x00007fcd2c2f9c4d libc_start_main + 253
51 clang 0x0000000000ea5299
Stack dump: