Take a look at this piece of C ++ code:
class Foo { int a; public: Foo(int b): a(a) {} };
Obviously, the developer wanted to initialize a with b , not a , and this is a pretty difficult mistake.
Clang ++ will warn about this possible error, while GCC will not, even with additional warnings enabled:
$ clang++ -c init.cpp init.cpp:5:27: warning: field is uninitialized when used here [-Wuninitialized] public: Foo(int b): a(a) {} ^ $ g++ -Wall -Wuninitialized -Winit-self -c init.cpp $
Is it likely to include the same output for g ++?
source share