http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56567
Bug #: 56567
Summary: ICE with lambda return type deduction and
braced-init-list
Classification: Unclassified
Product: gcc
Version: 4.8.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: [email protected]
ReportedBy: [email protected]
#include <string>
#include <iostream>
#include <initializer_list>
int main() {
for ( auto && s : []()
{ return { std::string( "first" ), std::string( "second" ) }; }() )
std::cout << s << '\n';
}
ildtice.cpp: In lambda function:
ildtice.cpp:7:61: internal compiler error: in make_decl_rtl, at varasm.c:1136
{ return { std::string( "first" ), std::string( "second" ) }; }() )
^
ildtice.cpp:7:61: internal compiler error: Abort trap: 6
g++: internal compiler error: Abort trap: 6 (program cc1plus)
C++11 5.1.2/4:
…
— if the compound-statement is of the form
{ attribute-specifier-seqopt return expression ; }
…
The return statement doesn't match the pattern because a braced-init-list is
not an expression. Should be a proper error.