<分区>
当使用带有 -Weverything -std=c++11
的 clang 3.8 编译以下代码时:
static void foo(long long) {}
int main() { foo(0ll); }
我收到以下警告:
警告:'long long' 与 C++98 不兼容 [-Wc++98-compat-pedantic]
这是诊断错误吗? (-Wc++98-compat-pedantic
包含在C++11模式的-Weverything
中)
转载here
<分区>
当使用带有 -Weverything -std=c++11
的 clang 3.8 编译以下代码时:
static void foo(long long) {}
int main() { foo(0ll); }
我收到以下警告:
警告:'long long' 与 C++98 不兼容 [-Wc++98-compat-pedantic]
这是诊断错误吗? (-Wc++98-compat-pedantic
包含在C++11模式的-Weverything
中)
转载here
最佳答案
不是真的。
即使您指定标准是 C++11,您也明确表示您想要启用所有警告。
引用文档:
In addition to the traditional -W flags, one can enable all diagnostics by passing -Weverything. This works as expected with -Werror, and also includes the warnings from -pedantic.
这对您使用的编译标准没有影响,-Wc++98-compat-pedantic
明确说“检查我的代码是否兼容C++98”,这就是它的作用。
关于c++ - 使用 Weverything 和 C++11 时出现与 clang 冲突的警告,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39959058/