当我升级到 gcc11 时,此代码无法在独立环境中编译

问题描述

代码
test.cc:

#include <atomic>
namespace syscall {
}
void _start() {
    while(true){
    }
}

构建命令:

 g++ -std=c++2a -ffreestanding -g -c test.cc

错误是什么(gcc11)?
test.cc:3:11: error: ‘namespace syscall { }’ redeclared as different kind of entity

但是可以在gcc10中编译。是UB吗?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)