https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120676
Nathaniel Shead <nshead at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED Resolution|--- |DUPLICATE CC| |nshead at gcc dot gnu.org --- Comment #1 from Nathaniel Shead <nshead at gcc dot gnu.org> --- Thanks for the report! The root cause appears to be due to this known deficiency GCC's module implementation, see https://gcc.gnu.org/onlinedocs/gcc/C_002b_002b-Modules.html: Textual merging of reachable GM entities Entities may be multiply defined across different header-units. These must be de-duplicated, and this is implemented across imports, or when an import redefines a textually-defined entity. However the reverse is not implemented—textually redefining an entity that has been defined in an imported header-unit. A redefinition error is emitted. --- In this example, the issue is that the 'import CompilerVersions' at the top of 'FunctionTraits.h' declares (hidden) names from e.g. <type_traits>, that are then redeclared by the '#include <type_traits>' later on in the file. This confuses the compiler and things go awry. In general, for now try to ensure that all #includes come before any imports that may declare the same entities; this will be particularly relevant for standard library headers of course. *** This bug has been marked as a duplicate of bug 99000 ***