https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120569
--- Comment #4 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The releases/gcc-15 branch has been updated by Jakub Jelinek <ja...@gcc.gnu.org>: https://gcc.gnu.org/g:b102e3d87c82bc901fb6a18324e2f33170b9162e commit r15-9955-gb102e3d87c82bc901fb6a18324e2f33170b9162e Author: Jakub Jelinek <ja...@redhat.com> Date: Thu Jul 10 23:41:56 2025 +0200 c++: Don't incorrectly reject override after class head name [PR120569] While the https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2025/p2786r13.html#c03-compatibility-changes-for-annex-c-diff.cpp03.dcl.dcl hunk dropped because struct C {}; struct C final {}; is actually not valid C++98 (which didn't have list initialization), we actually also reject struct D {}; struct D override {}; and that IMHO is valid all the way from C++11 onwards. Especially in the light of P2786R13 adding new contextual keywords, I think it is better to use a separate routine for parsing the class-virt-specifier-seq (in C++11, there was export next to final), class-virt-specifier (in C++14 to C++23) and class-property-specifier-seq (in C++26) instead of using the same function for virt-specifier-seq and class-property-specifier-seq. 2025-07-10 Jakub Jelinek <ja...@redhat.com> PR c++/120569 * parser.cc (cp_parser_class_property_specifier_seq_opt): New function. (cp_parser_class_head): Use it instead of cp_parser_property_specifier_seq_opt. Don't diagnose VIRT_SPEC_OVERRIDE here. Formatting fix. * g++.dg/cpp0x/override2.C: Expect different diagnostics with override. * g++.dg/cpp0x/override5.C: New test. (cherry picked from commit bcb51fe0e26bed7e2c44c4822ca6dec135ba61f3)