public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "jakub at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/94571] Error: Expected comma or semicolon, comma found
Date: Tue, 14 Apr 2020 08:30:56 +0000	[thread overview]
Message-ID: <bug-94571-4-p0yCAn8bHR@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-94571-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94571

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org

--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
It is a pasto, either we can go with the simple:
2020-04-14  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.

--- gcc/cp/parser.c.jj  2020-04-08 11:59:23.772460767 +0200
+++ gcc/cp/parser.c     2020-04-14 10:15:54.824034781 +0200
@@ -13675,7 +13675,7 @@ cp_parser_simple_declaration (cp_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.  */
--- gcc/testsuite/g++.dg/cpp1z/decomp51.C.jj    2020-04-14 10:18:58.318313777
+0200
+++ gcc/testsuite/g++.dg/cpp1z/decomp51.C       2020-04-14 10:19:31.347823985
+0200
@@ -0,0 +1,16 @@
+// PR c++/94571
+// { dg-do compile { target c++17 } }
+
+void
+foo ()
+{
+  int e[2], f[2];
+  auto [a,b] = e, [c,d] = f;   // { dg-error "expected ';' before ',' token" }
+}
+
+void
+bar ()
+{
+  int e[2];
+  auto [a, b] = e );           // { dg-error "expected ';' before '\\\)'
token" }
+}

change or can have a separate diagnostics for when there is a comma (but still
want the diagnostic about only ; expected when there is random garbage after
the expression).

  parent reply	other threads:[~2020-04-14  8:30 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-12 23:37 [Bug c++/94571] New: " bisqwit at iki dot fi
2020-04-12 23:43 ` [Bug c++/94571] " bisqwit at iki dot fi
2020-04-13 17:14 ` mpolacek at gcc dot gnu.org
2020-04-14  8:30 ` jakub at gcc dot gnu.org [this message]
2020-04-14 14:27 ` mpolacek at gcc dot gnu.org
2020-04-14 19:10 ` jakub at gcc dot gnu.org
2020-04-16  5:20 ` cvs-commit at gcc dot gnu.org
2020-09-16 19:20 ` cvs-commit at gcc dot gnu.org
2020-09-17 17:33 ` jakub at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-94571-4-p0yCAn8bHR@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).