This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/52288] New: Trouble with operator?: and lambdas


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]