5
|
olist · 技术社区 · 7 年前 |
![]() |
1
5
说明符
您的输出可能只是诊断消息中的一个错误。要确认编译器错误,您可以编写一些行为因decltype结果而异的代码,例如:
应该编译成功。 |
![]() |
2
3
不是答案,只是附加数据。 以下代码,
用Visual C++ 2017编译干净,但不使用明文G++7.2.0编译: [P:\temp] > g++ foo.cpp foo.cpp: In function 'int main()': foo.cpp:7:31: error: use of deleted function 'T<const int>::T()' T<decltype((const int)1)> t2; t2.x = 2; ^~ foo.cpp:1:31: note: 'T<const int>::T()' is implicitly deleted because the default definition would be ill-formed: â©ââtemplate< class Type > struct T{ Type x; }; ^ foo.cpp:1:31: error: uninitialized const member in 'struct T<const int>' foo.cpp:1:39: note: 'const int T<const int>::x' should be initialized â©ââtemplate< class Type > struct T{ Type x; }; ^ foo.cpp:7:42: error: assignment of read-only member 'T<const int>::x' T<decltype((const int)1)> t2; t2.x = 2; ^ [P:\temp] > _ 这表示存在g++编译器错误。 |
![]() |
ElectricRay81 · 从字符串到双精度的转换效果不好 2 年前 |
|
user9591123 · 转换字符串? 7 年前 |
![]() |
duckkkk · C中的类型转换(降级)[关闭] 7 年前 |
![]() |
MDS18 · 在构造函数中将int转换为float 7 年前 |