使用 Weverything 和 C++11 时出现与 clang 冲突的警告
conflicting warnings with clang when using Weverything and C++11
使用 clang 3.8 和 -Weverything -std=c++11
编译以下代码时:
static void foo(long long) {}
int main() { foo(0ll); }
我收到以下警告:
warning: 'long long' is incompatible with 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
明确 说 "check if my code is compatible with C++98",所以这就是它的作用。
使用 clang 3.8 和 -Weverything -std=c++11
编译以下代码时:
static void foo(long long) {}
int main() { foo(0ll); }
我收到以下警告:
warning: 'long long' is incompatible with 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
明确 说 "check if my code is compatible with C++98",所以这就是它的作用。