http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46449
--- Comment #5 from Jonathan Wakely <redi at gcc dot gnu.org> 2010-11-12 13:00:42 UTC --- (In reply to comment #3) > Is it a warning/error impossible? It seems a pretty easy error to make. How can the compiler know that some other file, which it doesn't know about, is going to redefine the class? Only the linker sees two definitions, so only the linker can warn. Apparently the Gold linker has some warnings to detect ODR violations of this sort. I don't know if it detects this case. The problem is identical to the case where you modify the definition of a class in a header and don't recompile all dependencies of the header. You end up with two incompatible definitions of a class in your program.