public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Jason Merrill <jason@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc r12-3536] c++: tweak C++20 destructor template-id rule
Date: Wed, 15 Sep 2021 04:05:40 +0000 (GMT)	[thread overview]
Message-ID: <20210915040540.89E293857814@sourceware.org> (raw)

https://gcc.gnu.org/g:f53a89fe722958d29fded71b444ff0f09b57b2c4

commit r12-3536-gf53a89fe722958d29fded71b444ff0f09b57b2c4
Author: Jason Merrill <jason@redhat.com>
Date:   Mon Sep 13 16:45:42 2021 -0400

    c++: tweak C++20 destructor template-id rule
    
    While working on a larger change to destructor lookup I noticed that this
    rule talks about declarators, but we weren't limiting the error to the case
    where we're parsing a declarator.  I don't know if this actually broke
    anything, since a CPP_TEMPLATE_ID would have to have been parsed once
    before, but it's more correct this way.
    
    gcc/cp/ChangeLog:
    
            * parser.c (cp_parser_unqualified_id): Only complain about ~A<T> in
            a declarator.

Diff:
---
 gcc/cp/parser.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index e44c5c6b57c..ab1dc81b997 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -6379,7 +6379,8 @@ cp_parser_unqualified_id (cp_parser* parser,
 
 	/* DR 2237 (C++20 only): A simple-template-id is no longer valid as the
 	   declarator-id of a constructor or destructor.  */
-	if (token->type == CPP_TEMPLATE_ID && cxx_dialect >= cxx20)
+	if (token->type == CPP_TEMPLATE_ID && declarator_p
+	    && cxx_dialect >= cxx20)
 	  {
 	    if (!cp_parser_simulate_error (parser))
 	      error_at (tilde_loc, "template-id not allowed for destructor");


                 reply	other threads:[~2021-09-15  4:05 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20210915040540.89E293857814@sourceware.org \
    --to=jason@gcc.gnu.org \
    --cc=gcc-cvs@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).