[LLVMbugs] [Bug 20705] New: Crash on invalid in lambda expression

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Aug 19 15:21:37 PDT 2014


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

            Bug ID: 20705
           Summary: Crash on invalid in lambda expression
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Frontend
          Assignee: unassignedclangbugs at nondot.org
          Reporter: rtrieu at google.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

test.cc:
template <typename T>
struct X {};
auto b = []() {
  struct S {
    static typename X<decltype(int)>::type Run(){};
  };
  return 5;
}();

commandline:
clang -cc1 test.cc -fsyntax-only -std=c++11

output:
test.cc:5:35: error: expected '(' for function-style cast or type construction
    static typename X<decltype(int)>::type Run(){};
                               ~~~^
test.cc:5:39: error: non-friend class member 'type' cannot have a qualified
name
    static typename X<decltype(int)>::type Run(){};
                                    ~~^
test.cc:5:39: error: no member named 'type' in the global namespace
    static typename X<decltype(int)>::type Run(){};
                                    ~~^
0  clang           0x00000000011a94e5 llvm::sys::PrintStackTrace(_IO_FILE*) +
37
1  clang           0x00000000011a9933
2  libpthread.so.0 0x00007f3556996cb0
3  clang           0x0000000001bd23dc
clang::Sema::FinalizeDeclaration(clang::Decl*) + 204
4  clang           0x00000000019ba470
clang::Parser::ParseCXXClassMemberDeclaration(clang::AccessSpecifier,
clang::AttributeList*, clang::Parser::ParsedTemplateInfo const&,
clang::ParsingDeclRAIIObject*) + 6960
5  clang           0x00000000019b6ace
clang::Parser::ParseCXXMemberSpecification(clang::SourceLocation,
clang::SourceLocation, clang::Parser::ParsedAttributesWithRange&, unsigned int,
clang::Decl*) + 3086
6  clang           0x00000000019b4c38
clang::Parser::ParseClassSpecifier(clang::tok::TokenKind,
clang::SourceLocation, clang::DeclSpec&, clang::Parser::ParsedTemplateInfo
const&, clang::AccessSpecifier, bool, clang::Parser::DeclSpecContext,
clang::Parser::ParsedAttributesWithRange&) + 7064
7  clang           0x000000000199a4f9
clang::Parser::ParseDeclarationSpecifiers(clang::DeclSpec&,
clang::Parser::ParsedTemplateInfo const&, clang::AccessSpecifier,
clang::Parser::DeclSpecContext, clang::Parser::LateParsedAttrList*) + 1577
8  clang           0x0000000001999d6b
clang::Parser::ParseSimpleDeclaration(llvm::SmallVector<clang::Stmt*, 32u>&,
unsigned int, clang::SourceLocation&,
clang::Parser::ParsedAttributesWithRange&, bool, clang::Parser::ForRangeInit*)
+ 379
9  clang           0x0000000001999b87
clang::Parser::ParseDeclaration(llvm::SmallVector<clang::Stmt*, 32u>&, unsigned
int, clang::SourceLocation&, clang::Parser::ParsedAttributesWithRange&) + 599
10 clang           0x00000000019f3b86
clang::Parser::ParseStatementOrDeclarationAfterAttributes(llvm::SmallVector<clang::Stmt*,
32u>&, bool, clang::SourceLocation*, clang::Parser::ParsedAttributesWithRange&)
+ 2726
11 clang           0x00000000019f306f
clang::Parser::ParseStatementOrDeclaration(llvm::SmallVector<clang::Stmt*,
32u>&, bool, clang::SourceLocation*) + 143
12 clang           0x00000000019f954f
clang::Parser::ParseCompoundStatementBody(bool) + 1423
13 clang           0x00000000019d0799
clang::Parser::ParseLambdaExpressionAfterIntroducer(clang::LambdaIntroducer&) +
4265
14 clang           0x00000000019cec10 clang::Parser::ParseLambdaExpression() +
288
15 clang           0x00000000019c2c96 clang::Parser::ParseCastExpression(bool,
bool, bool&, clang::Parser::TypeCastState) + 5046
16 clang           0x00000000019bf0a2
clang::Parser::ParseAssignmentExpression(clang::Parser::TypeCastState) + 130
17 clang           0x000000000199f235
clang::Parser::ParseDeclarationAfterDeclaratorAndAttributes(clang::Declarator&,
clang::Parser::ParsedTemplateInfo const&, clang::Parser::ForRangeInit*) + 3509
18 clang           0x000000000199d48f
clang::Parser::ParseDeclGroup(clang::ParsingDeclSpec&, unsigned int, bool,
clang::SourceLocation*, clang::Parser::ForRangeInit*) + 1695
19 clang           0x000000000198c34a
clang::Parser::ParseDeclOrFunctionDefInternal(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec&, clang::AccessSpecifier) + 794
20 clang           0x000000000198be20
clang::Parser::ParseDeclarationOrFunctionDefinition(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*, clang::AccessSpecifier) + 384
21 clang           0x000000000198b1e1
clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*) + 3393
22 clang           0x000000000198a414
clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&) + 388
23 clang           0x00000000019861f6 clang::ParseAST(clang::Sema&, bool, bool)
+ 422
24 clang           0x0000000001313c39 clang::FrontendAction::Execute() + 57
25 clang           0x00000000012e7ee3
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 787
26 clang           0x000000000138012c
clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 2844
27 clang           0x00000000006c5963 cc1_main(llvm::ArrayRef<char const*>,
char const*, void*) + 675
28 clang           0x00000000006c3b54 main + 7732
29 libc.so.6       0x00007f3555ebf78d __libc_start_main + 237
30 clang           0x00000000006c1bf1
Stack dump:
0.    Program arguments: clang -cc1 test.cc -fsyntax-only -std=c++11 
1.    test.cc:5:44: current parser token 'Run'
2.    test.cc:3:10: lambda expression parsing
3.    test.cc:3:15: in compound statement ('{}')
4.    test.cc:4:3: parsing struct/union/class body 'S'
Segmentation fault (core dumped)

-- 
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/20140819/d3ac279b/attachment.html>


More information about the llvm-bugs mailing list