IS是`auto ua = unsigned int {};`合法c++?
此代码使用MSVC编译,但不使用GCC或Clang编译。
auto a = int{};
auto ua = unsigned int {};
我强烈怀疑它可能是合法的C ++,但是古代之间的混合物” C样式 /带有空间的类型”以及在C ++中进行初始化的50种不同方法使这对编译器来说是非常困难的工作。
This code compiles with MSVC, but not with GCC or Clang.
auto a = int{};
auto ua = unsigned int {};
I strongly suspect it might be legit C++, but that the mix between the ancient "C style / types with spaces" and the 50 differents ways of doing initialization in C++ make this a very hard job for compilers.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
根据C ++ 20标准(7.6.1.4显式转换(功能符号)):
所以你需要写
According to the C++ 20 Standard (7.6.1.4 Explicit type conversion (functional notation)):
So you need to write