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

--- Comment #1 from Matt Godbolt <matt at godbolt dot org> 2012-11-29 20:03:47 
UTC ---
I can reproduce this on GCC 4.8 (rev 185382], and g++ 4.6.3.  Adding -O makes
the issue go away (as the whole program is optimized to "return 0;").

From the assembler dump the segv appears to happen when the compiler is
generating a "this" pointer for the inner lambda:

void oops<int>(Foo&, int const&)::{lambda()#1}::_FUN():
    pushq    %rbp
    movq    %rsp, %rbp
>>>     movl    $0, %edi
    call    void oops<int>(Foo&, int const&)::{lambda()#1}::operator()()
    popq    %rbp
    ret

[this output can also be seen at http://url.godbolt.org/mdjvf ]

Reply via email to