[LLVMbugs] [Bug 20762] New: Assertion on attempt to define class in class template with the same name
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Tue Aug 26 20:12:43 PDT 2014
http://llvm.org/bugs/show_bug.cgi?id=20762
Bug ID: 20762
Summary: Assertion on attempt to define class in class template
with the same name
Product: clang
Version: trunk
Hardware: All
OS: All
Status: NEW
Severity: normal
Priority: P
Component: C++
Assignee: unassignedclangbugs at nondot.org
Reporter: hstong at ca.ibm.com
CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
Classification: Unclassified
### SOURCE:
$ cat redefTmplInjClassName.cc
template <class T> struct Y {
struct Y { };
};
### COMPILER INVOCATION AND OUTPUT:
$ clang -cc1 -x c++ -std=c++03 redefTmplInjClassName.cc
clang: /build/clang/src/llvm/include/llvm/Support/Casting.h:223: typename
std::enable_if<(! llvm::is_simple_type<Y>::value), typename llvm::cast_retty<X,
const Y>::ret_type>::type llvm::cast(const Y&) [with X = clang::TagType; Y =
clang::QualType; typename std::enable_if<(! llvm::is_simple_type<Y>::value),
typename llvm::cast_retty<X, const Y>::ret_type>::type = const
clang::TagType*]: Assertion `isa<X>(Val) && "cast<Ty>() argument of
incompatible type!"' failed.
0 clang 0x0000000003c87265 llvm::sys::PrintStackTrace(_IO_FILE*) +
38
1 clang 0x0000000003c874e2
2 clang 0x0000000003c86e88
3 libpthread.so.0 0x00007f3ba26de340
4 libc.so.6 0x00007f3ba191af79 gsignal + 57
5 libc.so.6 0x00007f3ba191e388 abort + 328
6 libc.so.6 0x00007f3ba1913e36
7 libc.so.6 0x00007f3ba1913ee2
8 clang 0x00000000017816d4
9 clang 0x00000000017723b1 clang::Sema::ActOnTag(clang::Scope*,
unsigned int, clang::Sema::TagUseKind, clang::SourceLocation,
clang::CXXScopeSpec&, clang::IdentifierInfo*, clang::SourceLocation,
clang::AttributeList*, clang::AccessSpecifier, clang::SourceLocation,
llvm::MutableArrayRef<clang::TemplateParameterList*>, bool&, bool&,
clang::SourceLocation, bool,
clang::ActionResult<clang::OpaquePtr<clang::QualType>, false>, bool) + 6967
10 clang 0x0000000001624d5f
clang::Parser::ParseClassSpecifier(clang::tok::TokenKind,
clang::SourceLocation, clang::DeclSpec&, clang::Parser::ParsedTemplateInfo
const&, clang::AccessSpecifier, bool, clang::Parser::DeclSpecContext,
clang::Parser::ParsedAttributesWithRange&) + 7241
11 clang 0x0000000001611745
clang::Parser::ParseDeclarationSpecifiers(clang::DeclSpec&,
clang::Parser::ParsedTemplateInfo const&, clang::AccessSpecifier,
clang::Parser::DeclSpecContext, clang::Parser::LateParsedAttrList*) + 9067
12 clang 0x0000000001626a1d
clang::Parser::ParseCXXClassMemberDeclaration(clang::AccessSpecifier,
clang::AttributeList*, clang::Parser::ParsedTemplateInfo const&,
clang::ParsingDeclRAIIObject*) + 2149
13 clang 0x0000000001628d99
clang::Parser::ParseCXXMemberSpecification(clang::SourceLocation,
clang::SourceLocation, clang::Parser::ParsedAttributesWithRange&, unsigned int,
clang::Decl*) + 3271
14 clang 0x0000000001624f24
clang::Parser::ParseClassSpecifier(clang::tok::TokenKind,
clang::SourceLocation, clang::DeclSpec&, clang::Parser::ParsedTemplateInfo
const&, clang::AccessSpecifier, bool, clang::Parser::DeclSpecContext,
clang::Parser::ParsedAttributesWithRange&) + 7694
15 clang 0x0000000001611745
clang::Parser::ParseDeclarationSpecifiers(clang::DeclSpec&,
clang::Parser::ParsedTemplateInfo const&, clang::AccessSpecifier,
clang::Parser::DeclSpecContext, clang::Parser::LateParsedAttrList*) + 9067
16 clang 0x000000000166f8f0
clang::Parser::ParseSingleDeclarationAfterTemplate(unsigned int,
clang::Parser::ParsedTemplateInfo const&, clang::ParsingDeclRAIIObject&,
clang::SourceLocation&, clang::AccessSpecifier, clang::AttributeList*) + 622
17 clang 0x000000000166f61e
clang::Parser::ParseTemplateDeclarationOrSpecialization(unsigned int,
clang::SourceLocation&, clang::AccessSpecifier, clang::AttributeList*) + 1026
18 clang 0x000000000166f203
clang::Parser::ParseDeclarationStartingWithTemplate(unsigned int,
clang::SourceLocation&, clang::AccessSpecifier, clang::AttributeList*) + 209
19 clang 0x000000000160b3e0
clang::Parser::ParseDeclaration(llvm::SmallVector<clang::Stmt*, 32u>&, unsigned
int, clang::SourceLocation&, clang::Parser::ParsedAttributesWithRange&) + 218
20 clang 0x00000000015f9de6
clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*) + 1828
21 clang 0x00000000015f9678
clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&) + 538
22 clang 0x00000000015f2e1f clang::ParseAST(clang::Sema&, bool, bool)
+ 399
23 clang 0x00000000010af8c4 clang::ASTFrontendAction::ExecuteAction()
+ 322
24 clang 0x00000000010af39f clang::FrontendAction::Execute() + 139
25 clang 0x00000000010799bd
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 721
26 clang 0x000000000103d1eb
clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 993
27 clang 0x000000000102ad32 cc1_main(llvm::ArrayRef<char const*>,
char const*, void*) + 770
28 clang 0x0000000001037cbc
29 clang 0x00000000010380f0 main + 661
30 libc.so.6 0x00007f3ba1905ec5 __libc_start_main + 245
31 clang 0x0000000001029369
Stack dump:
0. Program arguments: clang -cc1 -x c++ -std=c++03 redefTmplInjClassName.cc
1. redefTmplInjClassName.cc:2:13: current parser token '{'
2. redefTmplInjClassName.cc:1:20: parsing struct/union/class body 'Y'
Aborted (core dumped)
### COMPILER VERSION INFO:
$ clang++ -v
clang version 3.6.0 (trunk 215824)
Target: x86_64-unknown-linux-gnu
Thread model: posix
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8.2
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9.0
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8
Candidate multilib: .;@m64
Selected multilib: .;@m64
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20140827/4b2a2c98/attachment.html>
More information about the llvm-bugs
mailing list