This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/50455] duplicate class/constructor silently accepted, wrong constructor linked
- From: "eda-qa at disemia dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 19 Sep 2011 12:53:33 +0000
- Subject: [Bug c++/50455] duplicate class/constructor silently accepted, wrong constructor linked
- Auto-submitted: auto-generated
- References: <bug-50455-4@http.gcc.gnu.org/bugzilla/>
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.