https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96969
Bug ID: 96969 Summary: ODR violations do not list the translation unit Product: gcc Version: 9.3.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: lto Assignee: unassigned at gcc dot gnu.org Reporter: alan at octopull dot co.uk CC: marxin at gcc dot gnu.org Target Milestone: --- ODR violations can occur in structures defined in headers whose contents depend on the inclusion context. For example: ./include/platform/mir/graphics/egl_extensions.h:164:12: error: type ‘struct PlatformBaseEXT’ violates the C++ One Definition Rule [-Werror=odr] ./include/platform/mir/graphics/egl_extensions.h:164:12: note: a different type is defined in another translation unit ./include/platform/mir/graphics/egl_extensions.h:168:47: note: the first difference of corresponding definitions is field ‘eglGetPlatformDisplay’ ./include/platform/mir/graphics/egl_extensions.h:168:47: note: a field with different name is defined in another translation unit The debug info in the .o should include the name of the "top level" file for the translation unit, even if the path from that file to a specific location in a header isn't stored. Alternatively, the name of the .o file would be helpful. Please add some information to the diagnostic messages that identifies the translation units that cause the ODR violation.