[LLVMbugs] [Bug 9525] New: crash on lookup for typo correction in templated operator
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Mon Mar 21 13:58:39 PDT 2011
http://llvm.org/bugs/show_bug.cgi?id=9525
Summary: crash on lookup for typo correction in templated
operator
Product: clang
Version: trunk
Platform: PC
OS/Version: Linux
Status: NEW
Severity: normal
Priority: P
Component: C++
AssignedTo: unassignedclangbugs at nondot.org
ReportedBy: nlewycky at google.com
CC: llvmbugs at cs.uiuc.edu, dgregor at apple.com
This code crashes clang:
template<typename T> struct BadLookup {
template<typename T> BadLookup<T>::operator++() {
int bucket;
__bucket; // replace with __bucketxx and the crash goes away
}
};
nlewycky at ducttape:~$ llvm/Debug+Asserts/bin/clang++ -fsyntax-only 000.ii
000.ii:2:21: error: declaration of 'T' shadows template parameter
template<typename T> BadLookup<T>::operator++() {
^
000.ii:1:19: note: template parameter is declared here
template<typename T> struct BadLookup {
^
000.ii:2:38: error: nested name specifier 'BadLookup<T>::' for declaration does
not refer into a class, class template or class template partial
specialization
template<typename T> BadLookup<T>::operator++() {
~~~~~~~~~~~~~~^
clang: DeclBase.cpp:461: void clang::Decl::CheckAccessDeclContext() const:
Assertion `Access != AS_none && "Access specifier is AS_none inside a record
decl"' failed.
0 clang 0x00000000024209c5
1 clang 0x00000000024207b8
2 libpthread.so.0 0x00007fdabaf2e8f0
3 libc.so.6 0x00007fdaba21da75 gsignal + 53
4 libc.so.6 0x00007fdaba2215c0 abort + 384
5 libc.so.6 0x00007fdaba216941 __assert_fail + 241
6 clang 0x00000000017b3de1 clang::Decl::CheckAccessDeclContext()
const + 277
7 clang 0x000000000112ea8e clang::Decl::getAccess() const + 24
8 clang 0x0000000001318be2
clang::LookupResult::addDecl(clang::NamedDecl*) + 28
9 clang 0x0000000001445333
clang::Sema::CppLookupName(clang::LookupResult&, clang::Scope*) + 365
10 clang 0x0000000001445f01
clang::Sema::LookupName(clang::LookupResult&, clang::Scope*, bool) + 795
11 clang 0x0000000001446e07
clang::Sema::LookupParsedName(clang::LookupResult&, clang::Scope*,
clang::CXXScopeSpec*, bool, bool) + 323
12 clang 0x000000000144b236
13 clang 0x000000000144cd6f
clang::Sema::CorrectTypo(clang::LookupResult&, clang::Scope*,
clang::CXXScopeSpec*, clang::DeclContext*, bool,
clang::Sema::CorrectTypoContext, clang::ObjCObjectPointerType const*) + 6601
14 clang 0x00000000013ce265
clang::Sema::DiagnoseEmptyLookup(clang::Scope*, clang::CXXScopeSpec&,
clang::LookupResult&, clang::Sema::CorrectTypoContext) + 1721
15 clang 0x00000000013cf63b
clang::Sema::ActOnIdExpression(clang::Scope*, clang::CXXScopeSpec&,
clang::UnqualifiedId&, bool, bool) + 1791
16 clang 0x00000000012dc377 clang::Parser::ParseCastExpression(bool,
bool, bool&, clang::OpaquePtr<clang::QualType>) + 2745
17 clang 0x00000000012db872 clang::Parser::ParseCastExpression(bool,
bool, clang::OpaquePtr<clang::QualType>) + 60
18 clang 0x00000000012dae34
clang::Parser::ParseAssignmentExpression() + 168
19 clang 0x00000000012dac26 clang::Parser::ParseExpression() + 24
20 clang 0x00000000012b13b3
clang::Parser::ParseStatementOrDeclaration(clang::ASTOwningVector<clang::Stmt*,
32u>&, bool) + 747
21 clang 0x00000000012b288a
clang::Parser::ParseCompoundStatementBody(bool) + 968
22 clang 0x00000000012b631d
clang::Parser::ParseFunctionStatementBody(clang::Decl*,
clang::Parser::ParseScope&) + 245
23 clang 0x00000000012f139d
clang::Parser::ParseLexedMethodDef(clang::Parser::LexedMethod&) + 927
24 clang 0x00000000012f0839
clang::Parser::LexedMethod::ParseLexedMethodDefs() + 35
25 clang 0x00000000012f0fbe
clang::Parser::ParseLexedMethodDefs(clang::Parser::ParsingClass&) + 242
26 clang 0x00000000012d6a83
clang::Parser::ParseCXXMemberSpecification(clang::SourceLocation, unsigned int,
clang::Decl*) + 1793
27 clang 0x00000000012d4335
clang::Parser::ParseClassSpecifier(clang::tok::TokenKind,
clang::SourceLocation, clang::DeclSpec&, clang::Parser::ParsedTemplateInfo
const&, clang::AccessSpecifier, bool) + 5809
28 clang 0x00000000012c71ba
clang::Parser::ParseDeclarationSpecifiers(clang::DeclSpec&,
clang::Parser::ParsedTemplateInfo const&, clang::AccessSpecifier,
clang::Parser::DeclSpecContext) + 6290
29 clang 0x00000000012ecc91
clang::Parser::ParseSingleDeclarationAfterTemplate(unsigned int,
clang::Parser::ParsedTemplateInfo const&,
clang::Parser::ParsingDeclRAIIObject&, clang::SourceLocation&,
clang::AccessSpecifier) + 385
30 clang 0x00000000012ecac2
clang::Parser::ParseTemplateDeclarationOrSpecialization(unsigned int,
clang::SourceLocation&, clang::AccessSpecifier) + 996
31 clang 0x00000000012ec647
clang::Parser::ParseDeclarationStartingWithTemplate(unsigned int,
clang::SourceLocation&, clang::AccessSpecifier) + 175
32 clang 0x00000000012c3dbf
clang::Parser::ParseDeclaration(clang::ASTOwningVector<clang::Stmt*, 32u>&,
unsigned int, clang::SourceLocation&,
clang::Parser::ParsedAttributesWithRange&) + 185
33 clang 0x00000000012bcd37
clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&,
clang::Parser::ParsingDeclSpec*) + 1225
34 clang 0x00000000012bc7de
clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&) + 210
35 clang 0x00000000012a4978 clang::ParseAST(clang::Sema&, bool) + 328
36 clang 0x000000000100c203 clang::ASTFrontendAction::ExecuteAction()
+ 263
37 clang 0x000000000100be54 clang::FrontendAction::Execute() + 326
38 clang 0x0000000000ff47c9
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 751
39 clang 0x0000000000f9d8c7
clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 912
40 clang 0x0000000000f8f757 cc1_main(char const**, char const**, char
const*, void*) + 982
41 clang 0x0000000000f990ac main + 499
42 libc.so.6 0x00007fdaba208c4d __libc_start_main + 253
43 clang 0x0000000000f8edf9
Stack dump:
0. Program arguments:
/usr/local/google/home/nlewycky/llvm/Debug+Asserts/bin/clang -cc1 -triple
x86_64-unknown-linux-gnu -fsyntax-only -disable-free -main-file-name 000.ii
-mrelocation-model static -mdisable-fp-elim -masm-verbose -mconstructor-aliases
-munwind-tables -target-cpu x86-64 -target-linker-version 2.20.1
-momit-leaf-frame-pointer -resource-dir
/usr/local/google/home/nlewycky/llvm/Debug+Asserts/bin/../lib/clang/3.0
-ferror-limit 19 -fmessage-length 80 -fcxx-exceptions -fexceptions
-fgnu-runtime -fdiagnostics-show-option -fcolor-diagnostics -x c++-cpp-output
000.ii
1. 000.ii:4:14: current parser token ';'
2. 000.ii:1:22: parsing struct/union/class body 'BadLookup'
3. 000.ii:2:51: parsing function body
4. 000.ii:2:51: in compound statement ('{}')
clang: error: unable to execute command: Aborted
clang: error: clang frontend command failed due to signal 1 (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