[Bug c++/50455] duplicate class/constructor silently accepted, wrong constructor linked
eda-qa at disemia dot com
gcc-bugzilla@gcc.gnu.org
Mon Sep 19 13:27:00 GMT 2011
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50455
--- Comment #8 from eda-qa at disemia dot com 2011-09-19 12:53:33 UTC ---
I agree that this is a violation of the ODR. I agree this might be difficult
for the linker to detect.
However for a user this is a serious problem that can be very hard to determine
without the help of the tool chain. Consider that in my original project the
duplicate definition was in some other library in the automake setup. This
implies that linking with *any* external library/object can introduce this
error into your project without any compiler/linker diagnostic.
I would suspect an average user would expect a "duplicate symbol" error for
this type of error. Otherwise this makes it unsafe to add new classes to any
C++ library, ever: any new class may silently replace the constructor of some
class by the user of the library.
More information about the Gcc-bugs
mailing list