https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99573
--- Comment #3 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Nathaniel Shead <nsh...@gcc.gnu.org>: https://gcc.gnu.org/g:bbb30f12a7e5ce008f59ec26c9e4cc65ee79fe56 commit r14-8974-gbbb30f12a7e5ce008f59ec26c9e4cc65ee79fe56 Author: Nathaniel Shead <nathanielosh...@gmail.com> Date: Mon Feb 12 12:40:15 2024 +1100 c++: Fix error recovery when redeclaring enum in different module [PR99573] This ensures that with modules enabled, redeclaring an enum in the wrong module or with the wrong underlying type no longer ICEs. The patch also rearranges the order of the checks a little because I think it's probably more important to note that you can't redeclare the enum all before complaining about mismatched underlying types etc. As a drive by this patch also adds some missing diagnostic groups, and rewords the module redeclaration error message to more closely match the wording used in other places this check is done. PR c++/99573 gcc/cp/ChangeLog: * decl.cc (start_enum): Reorder check for redeclaring in module. Add missing auto_diagnostic_groups. gcc/testsuite/ChangeLog: * g++.dg/modules/enum-12.C: New test. Signed-off-by: Nathaniel Shead <nathanielosh...@gmail.com> Reviewed-by: Jason Merrill <ja...@redhat.com>