[Bug c++/55223] New: [C++11] Default lambda expression of a templated class member
vince.rev at gmail dot com
gcc-bugzilla@gcc.gnu.org
Tue Nov 6 19:23:00 GMT 2012
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: unassigned@gcc.gnu.org
ReportedBy: vince.rev@gmail.com
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.
More information about the Gcc-bugs
mailing list