次の C++11 コードの問題点:
struct S
{
int a;
float b;
};
struct T
{
T(S s) {}
};
int main()
{
T t(S{1, 0.1}); // ERROR HERE
}
gcc は指定された行でエラーを返します (gcc 4.5 と gcc 4.6 の実験的ビルドの両方を試しました)
これは有効な C++11 ではありませんか、それとも gcc の実装が不完全ですか?
編集: コンパイラ エラーは次のとおりです。
test.cpp: In function int main():
test.cpp:14:10: error: expected ) before { token
test.cpp:14:10: error: a function-definition is not allowed here before { token
test.cpp:14:18: error: expected primary-expression before ) token
test.cpp:14:18: error: expected ; before ) token