http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55223
Bug #: 55223
Summary: [C++11] Default lambda expression of a templated class
member
Classification: Unclassified
Product: gcc
Version: 4.7.2
Status: UNCONFIRMED
Severity: major
Priority: P3
Component: c++
AssignedTo: [email protected]
ReportedBy: [email protected]
The following example returns a compiler error "internal compiler error : in
tsubst_copy, at cp/pt.c:11354". It occurs when the default std::function of a
templated class member is used :
//-----------------------------------------------------------
#include <iostream>
#include <functional>
template<typename T> struct C
{
static T test(std::function<T(int)> f = [](int i){return i;})
{return f(42);}
};
int main(int argc, char* argv[])
{
C<int>::test(); // ERROR = internal compiler error : in tsubst_copy, at
cp/pt.c:11354
C<int>::test([](int i){return i;}); // OK
return 0;
}
//-----------------------------------------------------------
Tested on GCC 4.6.3 and 4.7.2.