diff options
author | Jakub Jelinek <jakub@redhat.com> | 2024-08-30 09:40:34 +0200 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2024-08-30 09:40:34 +0200 |
commit | b748e2eed0df9e691a530a0b8faea9f673bdf2b5 (patch) | |
tree | 0d22e7ac0ddec26bae7fa9358656882ae9f7ff1b /gcc/gdbhooks.py | |
parent | ab214ef734bfc3dcffcf79ff9e1dd651c2b40566 (diff) | |
download | gcc-b748e2eed0df9e691a530a0b8faea9f673bdf2b5.zip gcc-b748e2eed0df9e691a530a0b8faea9f673bdf2b5.tar.gz gcc-b748e2eed0df9e691a530a0b8faea9f673bdf2b5.tar.bz2 |
c++: Allow standard attributes after closing square bracket in new-type-id [PR110345]
For C++ 26 P2552R3 I went through all the spots (except modules) where
attribute-specifier-seq appears in the grammar and tried to construct
a testcase in all those spots, for now for [[deprecated]] attribute.
The first thing I found is that we aren't parsing standard attributes in
noptr-new-declarator - https://eel.is/c++draft/expr.new#1
The following patch parses it there, for the non-outermost arrays
applies normally the attributes to the array type, for the outermost
where we just set *nelts and don't really build an array type just
warns that we ignore those attributes (or, do you think we should
just build an array type in that case and just take its element type?).
2024-08-30 Jakub Jelinek <jakub@redhat.com>
PR c++/110345
* parser.cc (make_array_declarator): Add STD_ATTRS argument, set
declarator->std_attributes to it.
(cp_parser_new_type_id): Warn on non-ignored std_attributes on the
array declarator which is being omitted.
(cp_parser_direct_new_declarator): Parse standard attributes after
closing square bracket, pass it to make_array_declarator.
(cp_parser_direct_declarator): Pass std_attrs to make_array_declarator
instead of setting declarator->std_attributes manually.
* g++.dg/cpp0x/gen-attrs-80.C: New test.
* g++.dg/cpp0x/gen-attrs-81.C: New test.
Diffstat (limited to 'gcc/gdbhooks.py')
0 files changed, 0 insertions, 0 deletions