ran*_*dom 10 c++ g++ clang++ c++17
两个编译器为此代码示例生成不同的结果.Clang生成两种不同的类型.G ++使用相同的类型fu和fi.哪一个符合标准?
#include <iostream>
template< auto IVAL>
struct foo {
decltype(IVAL) x = -IVAL;
};
int main()
{
foo<10u> fu;
foo<10> fi;
std::cout << fi.x << " " << fu.x << '\n';
return 0;
}
Run Code Online (Sandbox Code Playgroud)
g ++ - 7.3输出:
4294967286 4294967286
clang-6.0输出:
-10 4294967286
| 归档时间: |
|
| 查看次数: |
344 次 |
| 最近记录: |