diff options
author | Jakub Jelinek <jakub@redhat.com> | 2025-07-10 23:41:56 +0200 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2025-07-10 23:41:56 +0200 |
commit | bcb51fe0e26bed7e2c44c4822ca6dec135ba61f3 (patch) | |
tree | 215147cdce85c4703e003dc540d931e655476ba4 /libgfortran/generated/iany_i2.c | |
parent | baaee10123db6cf896283175b345d535b225defb (diff) | |
download | gcc-bcb51fe0e26bed7e2c44c4822ca6dec135ba61f3.zip gcc-bcb51fe0e26bed7e2c44c4822ca6dec135ba61f3.tar.gz gcc-bcb51fe0e26bed7e2c44c4822ca6dec135ba61f3.tar.bz2 |
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 <jakub@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 or duplicate final.
* g++.dg/cpp0x/override5.C: New test.
* g++.dg/cpp0x/duplicate1.C: Expect different diagnostics with
duplicate final.
Diffstat (limited to 'libgfortran/generated/iany_i2.c')
0 files changed, 0 insertions, 0 deletions