diff options
author | Jason Merrill <jason@redhat.com> | 2020-01-28 17:41:05 -0500 |
---|---|---|
committer | Jason Merrill <jason@redhat.com> | 2020-01-29 17:49:59 -0500 |
commit | 245e40af4fab5b7cf40fb310591a879355775971 (patch) | |
tree | 06ce229101cdb2d7663bfb2bc8784750125c8438 /gcc/go | |
parent | 165255c7a562e04e3be89eb1c87b4ac3c5248d77 (diff) | |
download | gcc-245e40af4fab5b7cf40fb310591a879355775971.zip gcc-245e40af4fab5b7cf40fb310591a879355775971.tar.gz gcc-245e40af4fab5b7cf40fb310591a879355775971.tar.bz2 |
c++: Fix attributes with lambda and trailing return type.
My fix for 60503 fixed handling of C++11 attributes following the
lambda-declarator. My patch for 89640 re-added support for GNU attributes,
but attributes after the trailing return type were parsed as applying to the
return type rather than to the function. This patch adjusts parsing of a
trailing-return-type to ignore GNU attributes at the end of the declaration
so that they will be applied to the declaration as a whole.
I also considered parsing the attributes between the closing paren and the
trailing-return-type, and tried a variety of approaches to implementing
that, but I think it's better to stick with the documented rule that "An
attribute specifier list may appear immediately before the comma, '=' or
semicolon terminating the declaration of an identifier...." Anyone
disagree?
Meanwhile, C++ committee discussion about the lack of any way to apply
attributes to a lambda op() seems to have concluded that they should go
between the introducer and declarator, so I've implemented that as well.
PR c++/90333
PR c++/89640
PR c++/60503
* parser.c (cp_parser_type_specifier_seq): Don't parse attributes in
a trailing return type.
(cp_parser_lambda_declarator_opt): Parse C++11 attributes before
parens.
Diffstat (limited to 'gcc/go')
0 files changed, 0 insertions, 0 deletions