[Bug c++/56222] New: Pointer to member in lambda should not require this to be captured

boris.bigott at hotmail dot com gcc-bugzilla@gcc.gnu.org
Wed Feb 6 11:09:00 GMT 2013


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56222

             Bug #: 56222
           Summary: Pointer to member in lambda should not require this to
                    be captured
    Classification: Unclassified
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: boris.bigott@hotmail.com


In the example below, gcc complains about this not being captures. This happens
whenever a pointer to a member function is requested in a lambda. I tested with
gcc-4.7.2.

struct Test {
    void y() { }
    void x() {
        [](Test &t) { (t.*(&Test::y))(); }(*this);
    }
};  

int main() {  Test().x(); }



More information about the Gcc-bugs mailing list