g++4.9 and g++5 different behaviour when narrowing in initializing list
Consider this code: #include <iostream> int main() { int i{10.1}; // narrowing, should not compile std::cout << i << std::endl; } According to the C++11 standard, it should not compile (narrowing in brace initialization is forbidden.) Now, compiling with g++4.9.2 -std=c++11 only emits a warning warning: narrowing conversion of '1.01e+1' from 'double' to 'int' inside { } [-Wnarrowing] Removing the -std=c++11 flag results in a warning regarding the brace init, but not any narrowing: warning: extended initializer lists only available with -std=c++11 or -std=gnu++11 On the other hand, g++5 doesn't