Jak określić domyślną funkcję jako parametr członka klasy?Błąd GCC lub nie: domyślnie std :: function?
Aktualnym przykładem pochodzi z mojego kodu jest:
#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;
}
Czy to jest bug GCC?
Czy można uniknąć tego problemu za pomocą innej składni?
Czy możesz wypróbować to na innych kompilatorach C++ 11 (dla osób, które je mają)?
wewnętrzny błąd kompilator zawsze jest to błąd w kompilator. –
'Czy możesz spróbować na innych kompilatorach C++ 11 (dla osób, które je mają)?' Robisz to! –
Może być taki sam jak: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53486 –