[LLVMbugs] [Bug 10631] New: Assertion 'isa<X>(Val) && "cast<Ty>() argument of incompatible type!' on invalid code

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Aug 10 01:43:48 PDT 2011


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

           Summary: Assertion 'isa<X>(Val) && "cast<Ty>() argument of
                    incompatible type!' on invalid 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


The code:

template<a>struct eval{struct eval{

Causes the following assertion on trunk clang++:

clang: /home/caj/clang/llvm-debug/include/llvm/Support/Casting.h:194: typename
llvm::cast_retty<To, From>::ret_type llvm::cast(const Y&) [with X =
clang::TagType, Y = clang::QualType, typename llvm::cast_retty<To,
From>::ret_type = const clang::TagType*]: Assertion `isa<X>(Val) && "cast<Ty>()
argument of incompatible type!"' failed.
0  clang           0x000000000299d542
1  clang           0x000000000299d33e
2  libpthread.so.0 0x00007fc1076e5c60
3  libc.so.6       0x00007fc1069d0d05 gsignal + 53
4  libc.so.6       0x00007fc1069d4ab6 abort + 390
5  libc.so.6       0x00007fc1069c97c5 __assert_fail + 245
6  clang           0x000000000134ac9f llvm::cast_retty<clang::TagType,
clang::QualType>::ret_type llvm::cast<clang::TagType,
clang::QualType>(clang::QualType const&) + 62
7  clang           0x0000000001587ef6 clang::Sema::ActOnTag(clang::Scope*,
unsigned int, clang::Sema::TagUseKind, clang::SourceLocation,
clang::CXXScopeSpec&, clang::IdentifierInfo*, clang::SourceLocation,
clang::AttributeList*, clang::AccessSpecifier,
clang::ASTMultiPtr<clang::TemplateParameterList*>, bool&, bool&, bool, bool,
clang::ActionResult<clang::OpaquePtr<clang::QualType>, false>) + 6152
8  clang           0x00000000014dab0e
clang::Parser::ParseClassSpecifier(clang::tok::TokenKind,
clang::SourceLocation, clang::DeclSpec&, clang::Parser::ParsedTemplateInfo
const&, clang::AccessSpecifier, bool) + 5636
9  clang           0x00000000014ccbd1
clang::Parser::ParseDeclarationSpecifiers(clang::DeclSpec&,
clang::Parser::ParsedTemplateInfo const&, clang::AccessSpecifier,
clang::Parser::DeclSpecContext) + 6545
10 clang           0x00000000014dc1cb
clang::Parser::ParseCXXClassMemberDeclaration(clang::AccessSpecifier,
clang::Parser::ParsedTemplateInfo const&,
clang::Parser::ParsingDeclRAIIObject*) + 1847
11 clang           0x00000000014ddacf
clang::Parser::ParseCXXMemberSpecification(clang::SourceLocation, unsigned int,
clang::Decl*) + 1911
12 clang           0x00000000014dacd8
clang::Parser::ParseClassSpecifier(clang::tok::TokenKind,
clang::SourceLocation, clang::DeclSpec&, clang::Parser::ParsedTemplateInfo
const&, clang::AccessSpecifier, bool) + 6094
13 clang           0x00000000014ccbd1
clang::Parser::ParseDeclarationSpecifiers(clang::DeclSpec&,
clang::Parser::ParsedTemplateInfo const&, clang::AccessSpecifier,
clang::Parser::DeclSpecContext) + 6545
14 clang           0x00000000014b2c5a
clang::Parser::ParseSingleDeclarationAfterTemplate(unsigned int,
clang::Parser::ParsedTemplateInfo const&,
clang::Parser::ParsingDeclRAIIObject&, clang::SourceLocation&,
clang::AccessSpecifier) + 420
15 clang           0x00000000014b2a6b
clang::Parser::ParseTemplateDeclarationOrSpecialization(unsigned int,
clang::SourceLocation&, clang::AccessSpecifier) + 975
16 clang           0x00000000014b2607
clang::Parser::ParseDeclarationStartingWithTemplate(unsigned int,
clang::SourceLocation&, clang::AccessSpecifier) + 167
17 clang           0x00000000014c92ac
clang::Parser::ParseDeclaration(clang::ASTOwningVector<clang::Stmt*, 32u>&,
unsigned int, clang::SourceLocation&,
clang::Parser::ParsedAttributesWithRange&) + 190
18 clang           0x00000000014bd2c4
clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&,
clang::Parser::ParsingDeclSpec*) + 1470
19 clang           0x00000000014bcc57
clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&) + 309
20 clang           0x000000000149d718 clang::ParseAST(clang::Sema&, bool) + 452
21 clang           0x00000000011daf75 clang::ASTFrontendAction::ExecuteAction()
+ 263
22 clang           0x000000000132ac68 clang::CodeGenAction::ExecuteAction() +
948
23 clang           0x00000000011dabd1 clang::FrontendAction::Execute() + 325
24 clang           0x00000000011c01bb
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 741
25 clang           0x0000000001192f11
clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 909
26 clang           0x0000000001183aff cc1_main(char const**, char const**, char
const*, void*) + 957
27 clang           0x000000000118e537 main + 496
28 libc.so.6       0x00007fc1069bbeff __libc_start_main + 255
29 clang           0x00000000011831c9
Stack dump:
0.    Program arguments: /llvmdebug/bin/clang -cc1 -triple
x86_64-unknown-linux-gnu -emit-obj -mrelax-all -disable-free -main-file-name
t.bashed.27598.cc -mrelocation-model static -mdisable-fp-elim -masm-verbose
-mconstructor-aliases -munwind-tables -target-cpu x86-64 -target-linker-version
2.21.51.20110409 -momit-leaf-frame-pointer -resource-dir
/llvmdebug/bin/../lib/clang/3.0 -fdeprecated-macro -ferror-limit 19
-fmessage-length 0 -fcxx-exceptions -fexceptions -fdiagnostics-show-option -o
/tmp/cc-lbTB5U.o -x c++ t.bashed.27598.cc 
1.    t.bashed.27598.cc:1:35: current parser token '{'
2.    t.bashed.27598.cc:1:12: parsing struct/union/class body 'eval'
clang: error: unable to execute command: Aborted
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 and
include command line arguments and all diagnostic information.
clang: note: diagnostic msg: Preprocessed source(s) are located at:
clang: note: diagnostic msg: /tmp/cc-lV8yFA.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