Cub*_*bbi 9 c++ g++ standards-compliance language-lawyer c++11
标准规定,在5.17/9之下
braced-init-list可能出现在右侧
- 对标量的赋值[...]
- 由用户定义的赋值运算符[...]定义的赋值
在GCC 4.5.1-pre9999中,我可以编译它(使用-std = c ++ 0x,NOT -std = gnu ++ 0x)
#include <iostream>
int main()
{
int test[] = {1,2,3};
std::cout << test[0] << test[1] << test[2];
test = {4,5,6};
std::cout << test[0] << test[1] << test[2] << std::endl;
}
Run Code Online (Sandbox Code Playgroud)
它打印出来123456.GCC在这里是否正确?
对我来说这看起来像是一个错误。初始化(int test = {1,2,3};)很好,但据我所知,标准中没有任何内容允许分配。
| 归档时间: |
|
| 查看次数: |
520 次 |
| 最近记录: |