[LLVMbugs] [Bug 12022] New: Trouble with operator ?: and lambdas
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Thu Feb 16 15:11:06 PST 2012
http://llvm.org/bugs/show_bug.cgi?id=12022
Bug #: 12022
Summary: Trouble with operator ?: and lambdas
Product: clang
Version: 3.0
Platform: PC
OS/Version: Linux
Status: NEW
Severity: normal
Priority: P
Component: C++0x
AssignedTo: unassignedclangbugs at nondot.org
ReportedBy: ivan at ootbcomp.com
CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
Classification: Unclassified
This code:
int main(int argc, char** argv) {
bool b;
void* p = b ? [argc](int i){ return i; } :
[argc](int i){ return i; };
return 0; }
gets you this (it also segfaults if the lambdas are preceded by "&"):
s3:~/clang/personal/ivan$ clang --std=c++0x foo.cc
\foo.cc:3:42: error: use of undeclared identifier 'i'
void* p = b ? [argc](int i){ return i; } :
^
foo.cc:4:33: error: use of undeclared identifier 'i'
[argc](int i){ return i; };
^
0 clang 0x000000000178246f
1 clang 0x0000000001782869
2 libpthread.so.0 0x0000003a51a0eee0
3 clang 0x00000000009d37de
clang::Sema::ActOnConditionalOp(clang::SourceLocation, clang::SourceLocation,
clang::Expr*, clang::Expr*, clang::Expr*) + 78
4 clang 0x00000000008a9c1d
clang::Parser::ParseRHSOfBinaryExpression(clang::ActionResult<clang::Expr*,
true>, clang::prec::Level) + 2141
5 clang 0x00000000008a93a9
clang::Parser::ParseAssignmentExpression() + 169
6 clang 0x0000000000897582
clang::Parser::ParseDeclarationAfterDeclaratorAndAttributes(clang::Declarator&,
clang::Parser::ParsedTemplateInfo const&) + 898
7 clang 0x0000000000896cb7
clang::Parser::ParseDeclGroup(clang::Parser::ParsingDeclSpec&, unsigned int,
bool, clang::SourceLocation*, clang::Parser::ForRangeInit*) + 1319
8 clang 0x0000000000894a7e
clang::Parser::ParseSimpleDeclaration(clang::ASTOwningVector<clang::Stmt*,
32u>&, unsigned int, clang::SourceLocation&, clang::ParsedAttributes&, bool,
clang::Parser::ForRangeInit*) + 670
9 clang 0x00000000008944ce
clang::Parser::ParseDeclaration(clang::ASTOwningVector<clang::Stmt*, 32u>&,
unsigned int, clang::SourceLocation&,
clang::Parser::ParsedAttributesWithRange&) + 254
10 clang 0x000000000087b39d
clang::Parser::ParseStatementOrDeclaration(clang::ASTOwningVector<clang::Stmt*,
32u>&, bool) + 1645
11 clang 0x000000000087f8d4
clang::Parser::ParseCompoundStatementBody(bool) + 452
12 clang 0x0000000000880c41
clang::Parser::ParseFunctionStatementBody(clang::Decl*,
clang::Parser::ParseScope&) + 161
13 clang 0x000000000088b73a
clang::Parser::ParseFunctionDefinition(clang::Parser::ParsingDeclarator&,
clang::Parser::ParsedTemplateInfo const&) + 1818
14 clang 0x0000000000896b24
clang::Parser::ParseDeclGroup(clang::Parser::ParsingDeclSpec&, unsigned int,
bool, clang::SourceLocation*, clang::Parser::ForRangeInit*) + 916
15 clang 0x000000000088abfb
clang::Parser::ParseDeclarationOrFunctionDefinition(clang::Parser::ParsingDeclSpec&,
clang::AccessSpecifier) + 667
16 clang 0x000000000088ad9a
clang::Parser::ParseDeclarationOrFunctionDefinition(clang::ParsedAttributes&,
clang::AccessSpecifier) + 394
17 clang 0x000000000088a24f
clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&,
clang::Parser::ParsingDeclSpec*) + 2687
18 clang 0x000000000088975e
clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&) + 254
19 clang 0x000000000087223e clang::ParseAST(clang::Sema&, bool) + 318
20 clang 0x0000000000781774 clang::CodeGenAction::ExecuteAction() +
756
21 clang 0x0000000000672467
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 887
22 clang 0x000000000065ed75
clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 2725
23 clang 0x0000000000657238 cc1_main(char const**, char const**, char
const*, void*) + 5704
24 clang 0x000000000065b25d main + 717
25 libc.so.6 0x0000003a5122135d __libc_start_main + 237
26 clang 0x0000000000655b29
Stack dump:
0. Program arguments:
/usr/local/clang/clang+llvm-3.0-x86_64-linux-Ubuntu-11_10/bin/clang -cc1
-triple x86_64-unknown-linux-gnu -emit-obj -mrelax-all -disable-free
-disable-llvm-verifier -main-file-name foo.cc -mrelocation-model static
-mdisable-fp-elim -masm-verbose -mconstructor-aliases -munwind-tables
-target-cpu x86-64 -target-linker-version 2.21.53.20110810
-momit-leaf-frame-pointer -resource-dir
/usr/local/clang/clang+llvm-3.0-x86_64-linux-Ubuntu-11_10/bin/../lib/clang/3.0
-fmodule-cache-path /var/tmp/clang-module-cache -internal-isystem
/usr/lib/gcc/x86_64-redhat-linux/4.6.1/../../../../include/c++/4.6.1
-internal-isystem
/usr/lib/gcc/x86_64-redhat-linux/4.6.1/../../../../include/c++/4.6.1/x86_64-redhat-linux
-internal-isystem
/usr/lib/gcc/x86_64-redhat-linux/4.6.1/../../../../include/c++/4.6.1/backward
-internal-isystem /usr/local/include -internal-isystem
/usr/local/clang/clang+llvm-3.0-x86_64-linux-Ubuntu-11_10/bin/../lib/clang/3.0/include
-internal-externc-isystem /usr/include -std=c++0x -fdeprecated-macro
-ferror-limit 19 -fmessage-length 80 -fgnu-runtime -fobjc-runtime-has-arc
-fobjc-runtime-has-weak -fobjc-fragile-abi -fcxx-exceptions -fexceptions
-fdiagnostics-show-option -fcolor-diagnostics -o /tmp/foo-etJ4D5.o -x c++
foo.cc
1. foo.cc:4:37: current parser token ';'
2. foo.cc:1:33: parsing function body 'main'
3. foo.cc:1:33: in compound statement ('{}')
clang: error: unable to execute command: Segmentation fault (core dumped)
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/bugs/ and include command line arguments and all diagnostic
information.
clang: note: diagnostic msg: Preprocessed source(s) are located at:
clang: note: diagnostic msg: /tmp/foo-EKpme6.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