Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Segfault compiling template with invalid nested type #10481

Closed
llvmbot opened this issue Jun 9, 2011 · 2 comments
Closed

Segfault compiling template with invalid nested type #10481

llvmbot opened this issue Jun 9, 2011 · 2 comments
Labels
bugzilla Issues migrated from bugzilla c++

Comments

@llvmbot
Copy link
Collaborator

llvmbot commented Jun 9, 2011

Bugzilla Link 10109
Resolution FIXED
Resolved on Jun 24, 2011 15:00
Version trunk
OS Linux
Attachments test source code
Reporter LLVM Bugzilla Contributor
CC @akyrtzi,@DougGregor,@tkremenek

Extended Description

The attached source code cannot be compiled with clang trunk/2.9. It is important that both the "template" and the "protected" keywords are present; with "public" or "private", it does not crash. I get the following crash message:

bug.cpp:5:13: error: template specialization or definition requires a template parameter list corresponding to the nested type 'A'
struct B::C;
^
bug.cpp:5:13: error: no struct named 'C' in 'A::B'
struct B::C;
~~~^
0 clang 0x00000000017e537f
1 clang 0x00000000017e57e9
2 libpthread.so.0 0x00007f81adad9020
3 clang 0x00000000008dfe1a
4 clang 0x00000000008e1359
5 clang 0x00000000008e2511
6 clang 0x00000000008e2779
7 clang 0x00000000008ebdc2 clang::Sema::HandleDelayedAccessCheck(clang::sema::DelayedDiagnostic&, clang::Decl*) + 1602
8 clang 0x000000000096c7fc clang::Sema::DelayedDiagnostics::popParsingDecl(clang::Sema&, clang::Sema::ParsingDeclState, clang::Decl*) + 124
9 clang 0x00000000008b4307 clang::Parser::ParseCXXClassMemberDeclaration(clang::AccessSpecifier, clang::Parser::ParsedTemplateInfo const&, clang::Parser::ParsingDeclRAIIObject*) + 5799
10 clang 0x00000000008b522f clang::Parser::ParseCXXMemberSpecification(clang::SourceLocation, unsigned int, clang::Decl*) + 1455
11 clang 0x00000000008b6360 clang::Parser::ParseClassSpecifier(clang::tok::TokenKind, clang::SourceLocation, clang::DeclSpec&, clang::Parser::ParsedTemplateInfo const&, clang::AccessSpecifier, bool) + 3376
12 clang 0x00000000008a3d51 clang::Parser::ParseDeclarationSpecifiers(clang::DeclSpec&, clang::Parser::ParsedTemplateInfo const&, clang::AccessSpecifier, clang::Parser::DeclSpecContext) + 1345
13 clang 0x0000000000886ddd clang::Parser::ParseSingleDeclarationAfterTemplate(unsigned int, clang::Parser::ParsedTemplateInfo const&, clang::Parser::ParsingDeclRAIIObject&, clang::SourceLocation&, clang::AccessSpecifier) + 749
14 clang 0x000000000088a106 clang::Parser::ParseTemplateDeclarationOrSpecialization(unsigned int, clang::SourceLocation&, clang::AccessSpecifier) + 614
15 clang 0x00000000008a841a clang::Parser::ParseDeclaration(clang::ASTOwningVector<clang::Stmt*, 32u>&, unsigned int, clang::SourceLocation&, clang::Parser::ParsedAttributesWithRange&) + 458
16 clang 0x0000000000896931 clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&, clang::Parser::ParsingDeclSpec*) + 769
17 clang 0x00000000008974bc clang::Parser::ParseTopLevelDecl(clang::OpaquePtrclang::DeclGroupRef&) + 140
18 clang 0x0000000000870c9d clang::ParseAST(clang::Sema&, bool) + 253
19 clang 0x0000000000750e13 clang::CodeGenAction::ExecuteAction() + 51
20 clang 0x000000000066a9a3 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 307
21 clang 0x000000000064a74b clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 955
22 clang 0x000000000063ff62 cc1_main(char const**, char const**, char const*, void*) + 706
23 clang 0x0000000000649106 main + 678
24 libc.so.6 0x00007f81acdbfead __libc_start_main + 253
25 clang 0x000000000063fb39
Stack dump:
0. Program arguments: /usr/local/stow/llvm/bin/clang -cc1 -triple x86_64-unknown-linux-gnu -emit-obj -mrelax-all -disable-free -disable-llvm-verifier -main-file-name bug.cpp -mrelocation-model static -mdisable-fp-elim -masm-verbose -mconstructor-aliases -munwind-tables -target-cpu x86-64 -target-linker-version 2.21.52.20110606 -momit-leaf-frame-pointer -resource-dir /usr/local/stow/llvm/bin/../lib/clang/3.0 -fdeprecated-macro -ferror-limit 19 -fmessage-length 266 -fcxx-exceptions -fexceptions -fgnu-runtime -fdiagnostics-show-option -fcolor-diagnostics -o /tmp/cc-MO7CtE.o -x c++ bug.cpp

  1.  bug.cpp:6:1: current parser token '}'
    
  2.  bug.cpp:2:1: parsing struct/union/class body 'A'
    

clang: error: unable to execute command: Segmentation fault
clang: error: clang frontend command failed due to signal 2 (use -v to see invocation)

@tkremenek
Copy link
Contributor

cloned to rdar://problem/9584039

@akyrtzi
Copy link
Contributor

akyrtzi commented Jun 24, 2011

Fixed in r133816.

@llvmbot llvmbot transferred this issue from llvm/llvm-bugzilla-archive Dec 3, 2021
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugzilla Issues migrated from bugzilla c++
Projects
None yet
Development

No branches or pull requests

3 participants