]> git.ipfire.org Git - thirdparty/gcc.git/commit
c++: Handle attributes on exception declarations [PR110345]
authorJakub Jelinek <jakub@redhat.com>
Wed, 18 Dec 2024 10:55:59 +0000 (11:55 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Wed, 18 Dec 2024 10:55:59 +0000 (11:55 +0100)
commit8b83820b68f358e21c740c0fcfb984e294f81ede
tree5eb9f8156d740486b484679991911ad8773ce8b3
parentd003a3862aeac72d0417cc41daafdf968bdb1839
c++: Handle attributes on exception declarations [PR110345]

This is a continuation of the series for the ignorability of standard
attributes.

I've added a test for assume attribute diagnostics appertaining to various
entities (mostly invalid) and while doing that, I've discovered that
attributes on exception declarations were mostly ignored, this patch
adds the missing cp_decl_attributes call and also in the
cp_parser_type_specifier_seq case differentiates between attributes and
std_attributes to be able to differentiate between attributes which apply
to the declaration using type-specifier-seq and attributes after the type
specifiers.

2024-12-18  Jakub Jelinek  <jakub@redhat.com>

PR c++/110345
* parser.cc (cp_parser_type_specifier_seq): Chain cxx11_attribute_p
attributes after any type specifier in the is_declaration case
to std_attributes rather than attributes.  Set also ds_attribute
or ds_std_attribute locations if not yet set.
(cp_parser_exception_declaration): Pass &type_specifiers.attributes
instead of NULL as last argument, call cp_decl_attributes.

* g++.dg/cpp0x/attr-assume1.C: New test.
gcc/cp/parser.cc
gcc/testsuite/g++.dg/cpp0x/attr-assume1.C [new file with mode: 0644]