gpt4 book ai didi

c++ - clang 在 Coliru 中编译此代码段,但不在 Compiler Explorer 中编译。为什么?

转载 作者:行者123 更新时间:2023-11-28 05:27:08 25 4
gpt4 key购买 nike

struct A{
constexpr A(){}
};

A a;

int main(){}

查看实例:ColiruCompiler explorer .

最佳答案

您在 coliru 中使用了以下编译选项,而不是在编译器资源管理器中:

-std=c++1z -O2 -Wall -pedantic -fno-elide-constructors -pthread

因为您的代码使用了 constexpr,所以这里的重要部分是 -std=c++1z 以启用现代 C++ 支持(准确地说是 C++17;注意-std=c++11 在这里启用 C++11 就足够了。

关于c++ - clang 在 Coliru 中编译此代码段,但不在 Compiler Explorer 中编译。为什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40305220/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com