:C++ 11 초기화 구문 문제 (GCC와 함께 4.5/4.6) 란 무엇 다음과 같은 C++ (11) 코드를 잘못
struct S
{
int a;
float b;
};
struct T
{
T(S s) {}
};
int main()
{
T t(S{1, 0.1}); // ERROR HERE
}
GCC가 표시된 줄에서 오류를 제공는 (I는 모두 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
후자는 일반적으로 특히 GCC4.5.x의 경우입니다. GCC4.6.x는 더 완벽하지만 버그가 있습니다. 가능한 경우 업데이트하십시오. – marko