[LLVMbugs] [Bug 8498] New: Assertion failure in template instantiation.

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Oct 28 11:33:33 PDT 2010


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

           Summary: Assertion failure in template instantiation.
           Product: clang
           Version: trunk
          Platform: Macintosh
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: benoit.belley at autodesk.com
                CC: llvmbugs at cs.uiuc.edu, dgregor at apple.com


Created an attachment (id=5692)
 --> (http://llvm.org/bugs/attachment.cgi?id=5692)
Test case

Clang crashes with an assertion when compiling the program attached (bug.cpp).
I am using revision 117443 from the llvm trunk.

------------ bug.cpp ------------

template<class T>
class Top
{
  struct Entry; ///< forward declared private class

  struct Entry {
    union {
    };
  };
};

class A {};

template class Top<A*>;
--------------------------------

$ clang ~/tmp/bug.cpp 
Assertion failed: ((Result || isa<UsingShadowDecl>(D) || D->isInvalidDecl() ||
cast<Decl>(ParentDC)->isInvalidDecl()) && "Unable to find instantiation of
declaration!"), function FindInstantiatedDecl, file
SemaTemplateInstantiateDecl.cpp, line 2780.
0  clang             0x00000001011f9b63 PrintStackTrace(void*) + 38
1  clang             0x00000001011fa11e SignalHandler(int) + 254
2  libSystem.B.dylib 0x00007fff88a3335a _sigtramp + 26
3  clang             0x0000000100745b62 getInterestingTagDecl(clang::TagDecl*)
+ 149
4  clang             0x000000010001ffb7 raise + 27
5  clang             0x000000010001ffc7 abort + 14
6  clang             0x0000000100020054 __gnu_cxx::new_allocator<std::pair<void
(*)(void*), void*> >::new_allocator() + 0
7  clang             0x00000001004d11a6
clang::Sema::FindInstantiatedDecl(clang::SourceLocation, clang::NamedDecl*,
clang::MultiLevelTemplateArgumentList const&) + 1828
8  clang             0x00000001004ad28b (anonymous
namespace)::TemplateInstantiator::TransformDecl(clang::SourceLocation,
clang::Decl*) + 359
9  clang             0x00000001004ad6bd clang::TreeTransform<(anonymous
namespace)::TemplateInstantiator>::TransformRecordType(clang::TypeLocBuilder&,
clang::RecordTypeLoc, clang::QualType) + 97
10 clang             0x00000001004bf77b clang::TreeTransform<(anonymous
namespace)::TemplateInstantiator>::TransformType(clang::TypeLocBuilder&,
clang::TypeLoc, clang::QualType) + 1509
11 clang             0x00000001004bffcb clang::TreeTransform<(anonymous
namespace)::TemplateInstantiator>::TransformElaboratedType(clang::TypeLocBuilder&,
clang::ElaboratedTypeLoc, clang::QualType) + 669
12 clang             0x00000001004bf7eb clang::TreeTransform<(anonymous
namespace)::TemplateInstantiator>::TransformType(clang::TypeLocBuilder&,
clang::TypeLoc, clang::QualType) + 1621
13 clang             0x00000001004ae29b clang::TreeTransform<(anonymous
namespace)::TemplateInstantiator>::TransformType(clang::TypeSourceInfo*,
clang::QualType) + 229
14 clang             0x00000001004b03d9
clang::Sema::SubstType(clang::TypeSourceInfo*,
clang::MultiLevelTemplateArgumentList const&, clang::SourceLocation,
clang::DeclarationName) + 279
15 clang             0x00000001004d5077 (anonymous
namespace)::TemplateDeclInstantiator::VisitFieldDecl(clang::FieldDecl*) + 215
16 clang             0x00000001004d63f8 clang::DeclVisitor<(anonymous
namespace)::TemplateDeclInstantiator, clang::Decl*>::Visit(clang::Decl*) + 978
17 clang             0x00000001004d8669 clang::Sema::SubstDecl(clang::Decl*,
clang::DeclContext*, clang::MultiLevelTemplateArgumentList const&) + 81
18 clang             0x00000001004b0a92
clang::Sema::InstantiateClass(clang::SourceLocation, clang::CXXRecordDecl*,
clang::CXXRecordDecl*, clang::MultiLevelTemplateArgumentList const&,
clang::TemplateSpecializationKind, bool) + 1078
19 clang             0x00000001004b11f4
clang::Sema::InstantiateClassMembers(clang::SourceLocation,
clang::CXXRecordDecl*, clang::MultiLevelTemplateArgumentList const&,
clang::TemplateSpecializationKind) + 1396
20 clang             0x00000001004c2bb4
clang::Sema::InstantiateClassTemplateSpecializationMembers(clang::SourceLocation,
clang::ClassTemplateSpecializationDecl*, clang::TemplateSpecializationKind) +
82
21 clang             0x000000010047dc54
clang::Sema::ActOnExplicitInstantiation(clang::Scope*, clang::SourceLocation,
clang::SourceLocation, unsigned int, clang::SourceLocation, clang::CXXScopeSpec
const&, clang::OpaquePtr<clang::TemplateName>, clang::SourceLocation,
clang::SourceLocation, clang::ASTTemplateArgsPtr, clang::SourceLocation,
clang::AttributeList*) + 1682
22 clang             0x000000010029ee32
clang::Parser::ParseClassSpecifier(clang::tok::TokenKind,
clang::SourceLocation, clang::DeclSpec&, clang::Parser::ParsedTemplateInfo
const&, clang::AccessSpecifier, bool) + 2992
23 clang             0x0000000100295c1d
clang::Parser::ParseDeclarationSpecifiers(clang::DeclSpec&,
clang::Parser::ParsedTemplateInfo const&, clang::AccessSpecifier,
clang::Parser::DeclSpecContext) + 5837
24 clang             0x00000001002c381d
clang::Parser::ParseSingleDeclarationAfterTemplate(unsigned int,
clang::Parser::ParsedTemplateInfo const&,
clang::Parser::ParsingDeclRAIIObject&, clang::SourceLocation&,
clang::AccessSpecifier) + 351
25 clang             0x00000001002c3c62
clang::Parser::ParseExplicitInstantiation(clang::SourceLocation,
clang::SourceLocation, clang::SourceLocation&) + 86
26 clang             0x00000001002c40e7
clang::Parser::ParseDeclarationStartingWithTemplate(unsigned int,
clang::SourceLocation&, clang::AccessSpecifier) + 133
27 clang             0x0000000100298d08
clang::Parser::ParseDeclaration(clang::ASTOwningVector<clang::Stmt*, 32u>&,
unsigned int, clang::SourceLocation&, clang::CXX0XAttributeList) + 478
28 clang             0x00000001002c9e18
clang::Parser::ParseExternalDeclaration(clang::CXX0XAttributeList,
clang::Parser::ParsingDeclSpec*) + 1800
29 clang             0x00000001002ca15d
clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&) + 307
30 clang             0x000000010028bb07 clang::ParseAST(clang::Sema&, bool) +
276
31 clang             0x0000000100080e93
clang::ASTFrontendAction::ExecuteAction() + 233
32 clang             0x000000010024e95c clang::CodeGenAction::ExecuteAction() +
826
33 clang             0x0000000100080f9a clang::FrontendAction::Execute() + 256
34 clang             0x00000001000631f8
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 710
35 clang             0x000000010002ae8d
clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 727
36 clang             0x0000000100020cf0 cc1_main(char const**, char const**,
char const*, void*) + 876
37 clang             0x0000000100027e06 main + 450
38 clang             0x0000000100020588 start + 52
39 clang             0x0000000000000023 start + 4294834895
Stack dump:
0.    Program arguments:
/Users/benoit/src/hippocrates-baseline/hgrepo/llvm/Debug+Asserts/bin/clang -cc1
-triple x86_64-apple-darwin10.0.0 -emit-obj -mrelax-all -disable-free
-main-file-name bug.cpp -pic-level 1 -mdisable-fp-elim -masm-verbose
-munwind-tables -target-cpu core2 -target-linker-version 97.14 -resource-dir
/Users/benoit/src/hippocrates-baseline/hgrepo/llvm/Debug+Asserts/bin/../lib/clang/2.9
-ferror-limit 19 -fmessage-length 182 -stack-protector 1 -fblocks -fexceptions
-fdiagnostics-show-option -fcolor-diagnostics -o
/var/folders/ut/utU3am6lE9quVbogvxQwK++++TI/-Tmp-/cc-1LS7O0.o -x c++
/Users/benoit/tmp/bug.cpp 
1.    /Users/benoit/tmp/bug.cpp:14:23: current parser token ';'
clang: error: clang frontend command failed due to signal 4 (use -v to see
invocation)

Benoit

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