https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122905
--- Comment #14 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Jakub Jelinek <[email protected]>: https://gcc.gnu.org/g:4d1bfc66f84de6b37b175a191cba8cdd552c4383 commit r16-5802-g4d1bfc66f84de6b37b175a191cba8cdd552c4383 Author: Jakub Jelinek <[email protected]> Date: Mon Dec 1 17:54:05 2025 +0100 c++: Fix ODR regressions caused by P2115R0 changes [PR122905] The following testcase fails due to ODR warnings starting with the r16-3233 change (P2115R0 PR120503 implementation). The problem is that for C++20 we mangle differently the anonymous union at the class scope from C++17, in C++17 the unnamed enumeration that has an enumerator as a name for linkage purposes before it is counted as TYPE_UNNAMED_P in nested_anon_class_index, but for C++20 it is not, therefore the ODR warning. While the term defined in https://eel.is/c++draft/dcl.enum#12.sentence-2 is defined for all enum types, its only use in https://eel.is/c++draft/basic.link#4.5 is solely for enumeration types at namespace scope, changing anything for those at class scope or block scope has undesirable ABI consequences. 2025-12-01 Jakub Jelinek <[email protected]> PR c++/122905 * decl.cc (enum_with_enumerator_for_linkage_p): Only return true for namespace scope types. * g++.dg/lto/pr122905.h: New file. * g++.dg/lto/pr122905_0.C: New test. * g++.dg/lto/pr122905_1.C: New test.
