[Bug c++/50939] New: [C++0x] lambda expression causes ICE when lambda captures const variable and odr-uses the variable in function templates

gwtnb0 at gmail dot com gcc-bugzilla@gcc.gnu.org
Tue Nov 1 03:54:00 GMT 2011


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

             Bug #: 50939
           Summary: [C++0x] lambda expression causes ICE when lambda
                    captures const variable and odr-uses the variable in
                    function templates
    Classification: Unclassified
           Product: gcc
           Version: 4.6.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: gwtnb0@gmail.com


Compiling the following code generates ICE:
===
template <typename T>
void foo(T x)
{
    int const a = x;
    [&]{ return &a; }();
}

int main()
{
    foo(100);
}
===
$ g++ -std=c++0x lambda.cc
lambda.cc: In lambda function:
lambda.cc:5:21: internal compiler error: in make_decl_rtl, at varasm.c:1163
Please submit a full bug report,
with preprocessed source if appropriate.
See <https://bugs.archlinux.org/> for instructions.
===



More information about the Gcc-bugs mailing list