I am working on a static analyzer for C ++ 11. There is an interaction between the static constant members of the class and the binding, for which I am not sure if this is defined. My static analyzer should warn about this only if this construct is not defined.
Example:
in the f1.cpp file:
struct Foo { static const int x = 2; }; int main(void) { return *&Foo::x; }
and in f2.cpp file:
struct Foo { static int x; }; int Foo::x;
Two files compiled and associated with clang++ -std=c++11 -Weverything f1.cpp f2.cpp
do not cause a warning and create a binary file that returns 0. The same files when compiled with g++ -std=c++11 -Wall -Wextra -pedantic f1.cpp f2.cpp
do not raise a warning and return 2.
My intuition is that this program is not defined, but a warning is not required because:
To be 100% sure of this, a definition for these "all type settings" is required, but cannot be found in the C ++ 11 standard. Are there any arguments, and are these arguments correct?
source share