[Bug c++/56400] New: Lambda's this pointer are not initialized inside template classes

gonzalobg88 at gmail dot com gcc-bugzilla@gcc.gnu.org
Tue Feb 19 20:38:00 GMT 2013


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

             Bug #: 56400
           Summary: Lambda's this pointer are not initialized inside
                    template classes
    Classification: Unclassified
           Product: gcc
           Version: 4.7.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: gonzalobg88@gmail.com


Created attachment 29501
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=29501
The first lambda produces a warning. It compiles but the program behaves wrong.
The second lambda crashes the compiler.

Compiling with: "g++-4.7.2 -std=c++11 -Wall -Wextra"

The first lambda produces the following warnign:
"warning: missing initializer for member ‘B<D>::foo() [with D =
void]::lambda()>::__this’ [-Wmissing-field-initializers]"

It recognizes that it has to capture the this pointer, but it does not
initialize it. The code compiles and the executable does not print 10 as it
should.

The second lambda crashes gcc with the following error:
"internal compiler error: in get_expr_operands, at tree-ssa-operands.c:1035"



More information about the Gcc-bugs mailing list