This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/52288] New: Trouble with operator?: and lambdas
- From: "igodard at pacbell dot net" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 16 Feb 2012 23:06:11 +0000
- Subject: [Bug c++/52288] New: Trouble with operator?: and lambdas
- Auto-submitted: auto-generated
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52288
Bug #: 52288
Summary: Trouble with operator?: and lambdas
Classification: Unclassified
Product: gcc
Version: 4.6.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: igodard@pacbell.net
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:
s3:~/ootbc/personal/ivan$ g++ --std=c++0x foo.cc
foo.cc: In function Ãint main(int, char**)Ã:
foo.cc:5:28: error: no match for ternary Ãoperator?:Ã in Ãb ? {argc} : {argc}Ã
which is a poor. Meanwhile 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:
s3:~/ootbc/personal/ivan$ g++ --std=c++0x foo.cc
foo.cc: In function Ãint main(int, char**)Ã:
foo.cc:4:42: error: taking address of temporary [-fpermissive]
foo.cc:5:29: error: taking address of temporary [-fpermissive]
foo.cc:5:29: error: conditional expression between distinct pointer types
Ãmain(int, char**)::<lambda(int)>*Ã and Ãmain(int, char**)::<lambda(int)>*Ã
lacks a cast
which is even worse.