Code for triggering the BUG:

float nested_lambda()
{
        float val;

        [val]()
        {
                [val]()
                {
                }
        }
}

 float nested_lambda() nested_lambda()::<lambda()>
<stdin>:7:4: internal compiler error: Szegmens hiba
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.

according to gdb, the segfault originates at: cp/semantics.c:2814, and it's a
null pointer dereferencing. After a bit of inspection, it was revealed that in
the code:

decl = add_default_capture (lambda_stack,

llambda_stack is NULL.

I tried the code:
float nested_lambda()
{
        float val;

        [val]()
        {
                float val2 = val;
                [val2]()
                {
                }
        }
}

which seems to be working fine.


-- 
           Summary: [cxx0x-lambda] Segfault because of a nested lambda
                    function
           Product: gcc
           Version: 4.5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: adam dot rak at streamnovation dot com
 GCC build triplet: x86_64-unknown-linux
  GCC host triplet: x86_64-unknown-linux
GCC target triplet: x86_64-unknown-linux


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

Reply via email to