[Bug libstdc++/31246] Strange -Wunreachable-code warning with _GLIBCXX_DEBUG

sylvain dot pion at sophia dot inria dot fr gcc-bugzilla@gcc.gnu.org
Sat Mar 17 17:27:00 GMT 2007



------- Comment #2 from sylvain dot pion at sophia dot inria dot fr  2007-03-17 17:26 -------
Trying further, I noticed that simply default constructing an std::vector<int>,
even without the debug mode _GLIBCXX_DEBUG, generates also a bunch (14 !) of
these warnings.

Andrew, I did not follow all the details of your explanation.  I don't
understand if there is finally a problem with the libstdc++ code or not.
And if there is, what should be done.

Is this a warning meant to be useful at all, or meant for GCC developers?

How do we get rid of this warning for the simplest C++ code I showed?


Other compilers are able to warn for unreachable code in better conditions.
for example, they warn for "int f() { return 1 ; return -1; }", and I
was trying to see if GCC was able to generate the same kind of warnings.
I only found -Wunreachable-code, but so far it proves unusable for C++.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31246



More information about the Gcc-bugs mailing list