diff options
author | Jakub Jelinek <jakub@redhat.com> | 2020-04-16 07:19:57 +0200 |
---|---|---|
committer | Jakub Jelinek <jakub@redhat.com> | 2020-04-16 07:19:57 +0200 |
commit | e4658c7dbbe88f742c96e5f58ee4a6d549d642ca (patch) | |
tree | 870ec5cb5b974a659b7883214d0b675482394b33 /gcc/cp | |
parent | b8a1750a9c5c47e278d132a34a5c2e9dbb040f80 (diff) | |
download | gcc-e4658c7dbbe88f742c96e5f58ee4a6d549d642ca.zip gcc-e4658c7dbbe88f742c96e5f58ee4a6d549d642ca.tar.gz gcc-e4658c7dbbe88f742c96e5f58ee4a6d549d642ca.tar.bz2 |
c++: Fix pasto in structured binding diagnostics [PR94571]
This snippet has been copied from the non-structured binding declaration
parsing later in the function, and while for non-structured bindings
it can be followed by comma or semicolon, structured bindings may be
only followed by semicolon.
Or, do we want to have a different message for the case when there is
a comma (and keep this corrected one only if there is something else)
that would explain better what is the bug (or add a fix-it hint)?
Marek said in the PR that clang++ reports
error: decomposition declaration must be the only declaration in its group
There is another thing Marek noted (though, something for different spot),
that diagnostic for auto x(1), [e,f] = test2; could also use a clearer
wording like the above (or a fix-it hint), but the question is if we should
assume [ after , as a structured binding or if we should do some tentative
parsing first to figure out if it looks like a structured binding.
2020-04-16 Jakub Jelinek <jakub@redhat.com>
PR c++/94571
* parser.c (cp_parser_simple_declaration): Fix up a pasto in
diagnostics.
* g++.dg/cpp1z/decomp51.C: New test.
Diffstat (limited to 'gcc/cp')
-rw-r--r-- | gcc/cp/ChangeLog | 16 | ||||
-rw-r--r-- | gcc/cp/parser.c | 2 |
2 files changed, 12 insertions, 6 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 0f53923..3e32405 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2020-04-16 Jakub Jelinek <jakub@redhat.com> + + PR c++/94571 + * parser.c (cp_parser_simple_declaration): Fix up a pasto in + diagnostics. + 2020-04-15 Jakub Jelinek <jakub@redhat.com> PR c/94593 @@ -97,7 +103,7 @@ LOOKUP_AGGREGATE_PAREN_INIT but don't build up a constructor yet. 2020-04-08 Iain Sandoe <iain@sandoe.co.uk> - Jun Ma <JunMa@linux.alibaba.com> + Jun Ma <JunMa@linux.alibaba.com> * coroutines.cc (maybe_promote_captured_temps): Add a cleanup expression, if needed, to any call from which we promoted @@ -762,7 +768,7 @@ * coroutines.cc (captures_temporary): Strip component_ref to its base object. -2020-03-03 Jun Ma <JunMa@linux.alibaba.com> +2020-03-03 Jun Ma <JunMa@linux.alibaba.com> * coroutines.cc (finish_co_await_expr): Build co_await_expr with unknown_type_node. @@ -991,7 +997,7 @@ * tree.c (cp_walk_subtrees): Walk CONSTRUCTOR types here. * pt.c (find_parameter_packs_r): Not here. -2020-02-12 Iain Sandoe <iain@sandoe.co.uk> +2020-02-12 Iain Sandoe <iain@sandoe.co.uk> * coroutines.cc (build_actor_fn): Implement deallocation function selection per n4849, dcl.fct.def.coroutine bullet 12. @@ -1146,7 +1152,7 @@ * coroutines.cc (maybe_promote_captured_temps): Increase the index number for temporary variables' name. -2020-02-05 Jun Ma <JunMa@linux.alibaba.com> +2020-02-05 Jun Ma <JunMa@linux.alibaba.com> * coroutines.cc (build_co_await): Call convert_from_reference to wrap co_await_expr with indirect_ref which avoid @@ -1221,7 +1227,7 @@ * cp-gimplify.c (predeclare_vla): New. (cp_genericize_r) [NOP_EXPR]: Call it. -2020-02-03 Jun Ma <JunMa@linux.alibaba.com> +2020-02-03 Jun Ma <JunMa@linux.alibaba.com> * coroutines.cc (transform_await_wrapper): Set actor funcion as new context of label_decl. diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index 3855416..7be4a8f 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -13675,7 +13675,7 @@ cp_parser_simple_declaration (cp_parser* parser, if ((decl != error_mark_node && DECL_INITIAL (decl) != error_mark_node) || cp_parser_uncommitted_to_tentative_parse_p (parser)) - cp_parser_error (parser, "expected %<,%> or %<;%>"); + cp_parser_error (parser, "expected %<;%>"); /* Skip tokens until we reach the end of the statement. */ cp_parser_skip_to_end_of_statement (parser); /* If the next token is now a `;', consume it. */ |