この小さなテストプログラム:
#include <functional>
//template<class T> // <-- with this, gcc compiles ok
template<class T=void>
struct c{
std::function<int(int)> f = [](int i){return i+i;};
};
int main() {};
Clang-3.2は問題なくコンパイルしますが、GCC4.7.1および4.8から奇妙なエラーが発生します。
t.cc:6:31: error: default argument for template parameter for class enclosing ‘struct __lambda0’
function<int(int)> f = [](int i){return i+i;};
^
これは、誰も知らないあいまいなC ++ルールの例外の1つですか、それともGCCのバグですか?
編集 バグのように見えます。バグレポートを提出しました