考虑这个奇怪的程序:
int main()
{
int(*){} Is it C++14 or any other language?
}
(观看现场演示here http://melpon.org/wandbox/permlink/YYiMrSh2AIrHxbWy & here http://cpp.sh/46vs.)
尽管评论//
不见了,即使我使用,代码也可以正常编译,没有任何错误和警告-pedantic-errors
g++ 6.0 中的选项。对我来说这似乎是一个编译器错误。这真的是编译器中的错误吗?
在我可以测试的所有版本中,这看起来都是 g++ 的错误/功能/问题。跑步
int main()
{
int(*){} Is it C++14 or any other language?
}
On 上帝螺栓.org http://gcc.godbolt.org/对于没有编译标志的所有版本的 g++,给出以下汇编输出。
main:
pushq %rbp
movq %rsp, %rbp
movl $0, %eax
leave
ret
我得到的唯一诊断是上帝螺栓.org http://gcc.godbolt.org/那就是
!!warning: extended initializer lists only available with -std=c++0x or -std=gnu++0x
Clang、ICC 和 MSVS 都无法编译此文件。
EDIT:
来自评论zwol https://stackoverflow.com/users/388520/zwol就此向 gcc 提交了一个错误。可以找到错误报告here https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68265.
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)