[LLVMbugs] [Bug 7022] New: Assert `isa<X>(Val) && "cast<Ty>() argument of incompatible type!"' on valid code

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon May 3 03:24:55 PDT 2010


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

           Summary: Assert `isa<X>(Val) && "cast<Ty>() argument of
                    incompatible type!"' on valid code
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: chris at bubblescope.net
                CC: llvmbugs at cs.uiuc.edu, dgregor at apple.com


Created an attachment (id=4805)
 --> (http://llvm.org/bugs/attachment.cgi?id=4805)
Asserting test case derived from boost

The following testcase, derived from boost, is I believe valid code and causes
an assertion on clang++.

This bug may be related to #6310 as it is the same assertion.

Assertion failed: (isa<X>(Val) && "cast<Ty>() argument of incompatible type!"),
function cast, file /Users/caj/clang/llvm/include/llvm/Support/Casting.h, line
202.
0  clang             0x00f54489 PrintStackTrace(void*) + 45
1  clang             0x00f549d3 SignalHandler(int) + 374
2  libSystem.B.dylib 0x91cc842b _sigtramp + 43
3  libSystem.B.dylib 0xffffffff _sigtramp + 1848867839
4  libSystem.B.dylib 0x91d558e5 raise + 26
5  libSystem.B.dylib 0x91d6b99c abort + 93
6  libSystem.B.dylib 0x91d58544 __pthread_markcancel + 0
7  clang             0x003d87a5 llvm::cast_retty<clang::FunctionProtoTypeLoc,
clang::TypeLoc*>::ret_type llvm::cast<clang::FunctionProtoTypeLoc,
clang::TypeLoc*>(clang::TypeLoc* const&) + 91
8  clang             0x003d19aa (anonymous
namespace)::TemplateDeclInstantiator::SubstFunctionType(clang::FunctionDecl*,
llvm::SmallVectorImpl<clang::ParmVarDecl*>&) + 572
9  clang             0x003d1c9f (anonymous
namespace)::TemplateDeclInstantiator::VisitCXXMethodDecl(clang::CXXMethodDecl*,
clang::TemplateParameterList*) + 471
10 clang             0x003d5864 clang::DeclVisitor<(anonymous
namespace)::TemplateDeclInstantiator, clang::Decl*>::Visit(clang::Decl*) + 702
11 clang             0x003d6f37 clang::Sema::SubstDecl(clang::Decl*,
clang::DeclContext*, clang::MultiLevelTemplateArgumentList const&) + 71
12 clang             0x003bd3bb
clang::Sema::InstantiateClass(clang::SourceLocation, clang::CXXRecordDecl*,
clang::CXXRecordDecl*, clang::MultiLevelTemplateArgumentList const&,
clang::TemplateSpecializationKind, bool) + 959
13 clang             0x003c44d7
clang::Sema::InstantiateClassTemplateSpecialization(clang::SourceLocation,
clang::ClassTemplateSpecializationDecl*, clang::TemplateSpecializationKind,
bool) + 1609
14 clang             0x003da635
clang::Sema::RequireCompleteType(clang::SourceLocation, clang::QualType,
clang::PartialDiagnostic const&, std::pair<clang::SourceLocation,
clang::PartialDiagnostic>) + 259
15 clang             0x003daabc
clang::Sema::RequireCompleteType(clang::SourceLocation, clang::QualType,
clang::PartialDiagnostic const&) + 114
16 clang             0x003131ae
clang::Sema::ActOnCXXTypeConstructExpr(clang::SourceRange, void*,
clang::SourceLocation,
clang::ASTMultiPtr<&(clang::ActionBase::DeleteExpr(void*))>,
clang::SourceLocation*, clang::SourceLocation) + 754
17 clang             0x0039c60f clang::TreeTransform<(anonymous
namespace)::TemplateInstantiator>::RebuildCXXUnresolvedConstructExpr(clang::SourceLocation,
clang::QualType, clang::SourceLocation,
clang::ASTMultiPtr<&(clang::ActionBase::DeleteExpr(void*))>,
clang::SourceLocation*, clang::SourceLocation) + 201
18 clang             0x003b5d25 clang::TreeTransform<(anonymous
namespace)::TemplateInstantiator>::TransformCXXUnresolvedConstructExpr(clang::CXXUnresolvedConstructExpr*)
+ 1053
19 clang             0x003aa2e8 clang::TreeTransform<(anonymous
namespace)::TemplateInstantiator>::TransformExpr(clang::Expr*) + 6392
20 clang             0x003bf039 clang::Sema::SubstExpr(clang::Expr*,
clang::MultiLevelTemplateArgumentList const&) + 165
21 clang             0x002e8a0c
clang::Sema::BuildCXXDefaultArgExpr(clang::SourceLocation,
clang::FunctionDecl*, clang::ParmVarDecl*) + 466
22 clang             0x002f5879
clang::Sema::GatherArgumentsForCall(clang::SourceLocation,
clang::FunctionDecl*, clang::FunctionProtoType const*, unsigned int,
clang::Expr**, unsigned int, llvm::SmallVector<clang::Expr*, 8u>&,
clang::Sema::VariadicCallType) + 759
23 clang             0x002b0f13
clang::Sema::CompleteConstructorCall(clang::CXXConstructorDecl*,
clang::ASTMultiPtr<&(clang::ActionBase::DeleteExpr(void*))>,
clang::SourceLocation,
clang::ASTOwningVector<&(clang::ActionBase::DeleteExpr(void*)), 8u>&) + 313
24 clang             0x00326485
clang::InitializationSequence::Perform(clang::Sema&, clang::InitializedEntity
const&, clang::InitializationKind const&,
clang::ASTMultiPtr<&(clang::ActionBase::DeleteExpr(void*))>, clang::QualType*)
+ 7663
25 clang             0x002823ce
clang::Sema::ActOnUninitializedDecl(clang::OpaquePtr<0>, bool) + 1906
26 clang             0x005d5d1b
clang::Parser::ParseDeclarationAfterDeclarator(clang::Declarator&,
clang::Parser::ParsedTemplateInfo const&) + 2513
27 clang             0x005d5fe5
clang::Parser::ParseDeclGroup(clang::Parser::ParsingDeclSpec&, unsigned int,
bool, clang::SourceLocation*) + 691
28 clang             0x005d63f6 clang::Parser::ParseSimpleDeclaration(unsigned
int, clang::SourceLocation&, clang::AttributeList*, bool) + 340
29 clang             0x005d66b7 clang::Parser::ParseDeclaration(unsigned int,
clang::SourceLocation&, clang::CXX0XAttributeList) + 669
30 clang             0x00603e95
clang::Parser::ParseStatementOrDeclaration(bool) + 1377
31 clang             0x006086cb clang::Parser::ParseCompoundStatementBody(bool)
+ 215
32 clang             0x00608d2f
clang::Parser::ParseFunctionStatementBody(clang::OpaquePtr<0>) + 199
33 clang             0x00612362
clang::Parser::ParseFunctionDefinition(clang::Parser::ParsingDeclarator&,
clang::Parser::ParsedTemplateInfo const&) + 1196
34 clang             0x005d5f15
clang::Parser::ParseDeclGroup(clang::Parser::ParsingDeclSpec&, unsigned int,
bool, clang::SourceLocation*) + 483
35 clang             0x006113df
clang::Parser::ParseDeclarationOrFunctionDefinition(clang::Parser::ParsingDeclSpec&,
clang::AttributeList*, clang::AccessSpecifier) + 1001
36 clang             0x0061142c
clang::Parser::ParseDeclarationOrFunctionDefinition(clang::AttributeList*,
clang::AccessSpecifier) + 66
37 clang             0x006131a4
clang::Parser::ParseExternalDeclaration(clang::CXX0XAttributeList) + 2222
38 clang             0x006132ea
clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<1>&) + 268
39 clang             0x0023ff35 clang::ParseAST(clang::Preprocessor&,
clang::ASTConsumer*, clang::ASTContext&, bool, bool,
clang::CodeCompleteConsumer*) + 426
40 clang             0x00063d6f clang::ASTFrontendAction::ExecuteAction() + 269
41 clang             0x00063e8c clang::FrontendAction::Execute() + 278
42 clang             0x00047ea3
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 879
43 clang             0x0002ab7f cc1_main(char const**, char const**, char
const*, void*) + 1979
44 clang             0x0002eaa5 main + 272
45 clang             0x000298bd start + 53
46 clang             0x00000020 start + 4294797208
Stack dump:
0.    Program arguments: /usr/local/bin/clang -cc1 -triple
i386-apple-darwin10.0.0 -S -disable-free -main-file-name incompatible_type.cc
-pic-level 1 -mdisable-fp-elim -target-cpu yonah -resource-dir
/usr/local/lib/clang/2.0 -ferror-limit 19 -ftemplate-backtrace-limit 10
-fmessage-length 107 -stack-protector 1 -fblocks -fexceptions
-fdiagnostics-show-option -fcolor-diagnostics -o
/var/folders/M8/M86fCFVgGQ0r-V2oY5lLC++++TI/-Tmp-/cc-3Ha7WB.s -x c++
incompatible_type.cc 
1.    incompatible_type.cc:18:17: current parser token ';'
2.    incompatible_type.cc:16:1: parsing function body 'm'
3.    incompatible_type.cc:16:1: in compound statement ('{}')
clang: error: compiler command failed due to signal 6 (use -v to see
invocation)

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