例如:
int main() {
struct {} foo;
int bar[0];
struct {
int dummy[0];
} baz;
cout << sizeof(foo) << endl; //display '1'
cout << sizeof(bar) << endl; //display '0'
cout << sizeof(baz) << endl; //display '0'
return 0;
}
Run Code Online (Sandbox Code Playgroud)
请告诉我是否有任何理由支持编译器行为
指令:
#ifndef __cplusplus
#error C++ is required
#elif __cplusplus < 201402L
#error C++14 is required
#endif
Run Code Online (Sandbox Code Playgroud)
命令行: g++ -Wall -Wextra -std=c++14 -c -o header.o header.hpp
我的g ++版本: g++ (tdm-1) 4.9.2
C++14 is required即使我添加了错误也会生成-std=c++14,我不知道为什么.
请告诉我如何解决这个问题.