https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93585
--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> --- (In reply to Norman Goldstein from comment #0) > The type of "foo" is different in the two files: Yes, you've violated the C++ One-Definition Rule, which means your program is ill-formed, but the implementation is not required to diagnose it (because it's impractical to do in some cases). See https://en.wikipedia.org/wiki/One_Definition_Rule https://en.cppreference.com/w/cpp/language/definition (and lots of other reults found by a web search)