https://llvm.org/bugs/show_bug.cgi?id=24161
Bug ID: 24161
Summary: unexpected syntax error: operator[] mistaken for
lambda capture
Product: clang
Version: 3.4
Hardware: Macintosh
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: C++11
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected], [email protected]
Classification: Unclassified
Created attachment 14603
--> https://llvm.org/bugs/attachment.cgi?id=14603&action=edit
Reproduces unexpected syntax error
Vec is a class that has a default constructor and operator[](int) defined. This
construct (resulting from a macro expansion) fails to compile with clang 3.4
C++11, but succeeds with gcc 4.8.2 and VS2015:
if ((std::abs(((Vec())[0]))/3. > 0))
printf("hi\n");
The error is:
c++ -std=c++11 crash2.cpp
crash2.cpp:61:28: error: expected variable name or 'this' in lambda capture
list
if ((std::abs(((Vec())[0]))/3. > 0))
^
Removing the extra set of parentheses around Vec() eliminates the error.
I've attached a complete program that fails to compile.
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs