diff options
author | Jakub Jelinek <jakub@redhat.com> | 2021-04-16 09:34:26 +0200 |
---|---|---|
committer | Jakub Jelinek <jakub@redhat.com> | 2021-04-16 09:34:26 +0200 |
commit | 784de5292c34e287c848b382b431599b818ea76e (patch) | |
tree | 3dc8b374403f140ce4b8a6155a98876e0d6c7cc2 /gcc/tree-vect-loop.c | |
parent | 20eb7a1891cfd7fa85295a236cebe0322d041edd (diff) | |
download | gcc-784de5292c34e287c848b382b431599b818ea76e.zip gcc-784de5292c34e287c848b382b431599b818ea76e.tar.gz gcc-784de5292c34e287c848b382b431599b818ea76e.tar.bz2 |
c++: Fix up C++23 [] <...> requires primary -> type {} parsing [PR99850]
The requires clause parsing has code to suggest users wrapping
non-primary expressions in (), so if it e.g. parses a primary expression
and sees it is followed by ++, --, ., ( or -> among other things it
will try to reparse it as assignment expression or what and if that works
suggests wrapping it inside of parens.
When it is requires-clause that is after <typename T> etc. it already
has an exception from that as ( can occur in valid C++20 expression there
- starting the parameters of the lambda.
In C++23 another case can occur, as the parameters with the ()s can be
omitted, requires C can be followed immediately by -> which starts a
trailing return type. Even in that case, we don't want to parse that
as C->...
2021-04-16 Jakub Jelinek <jakub@redhat.com>
PR c++/99850
* parser.c (cp_parser_constraint_requires_parens) <case CPP_DEREF>:
If lambda_p, return pce_ok instead of pce_maybe_postfix.
* g++.dg/cpp23/lambda-specifiers2.C: New test.
Diffstat (limited to 'gcc/tree-vect-loop.c')
0 files changed, 0 insertions, 0 deletions