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-8537] c++: simpler fix for PR106024
Date: Fri,  1 Jul 2022 15:42:41 +0000 (GMT)	[thread overview]
Message-ID: <20220701154241.E7A133858D28@sourceware.org> (raw)

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

commit r12-8537-ge748398b3ef6412ef35b85ef6b0893809aeb49cd
Author: Jason Merrill <jason@redhat.com>
Date:   Fri Jul 1 11:02:54 2022 -0400

    c++: simpler fix for PR106024
    
    Actually, for release branches let's just avoid the lookup for the lambdas
    that are the problematic case and only make the bigger change on trunk.
    
            PR c++/106024
    
    gcc/cp/ChangeLog:
    
            * parser.cc (cp_parser_lookup_name): Limit previous change to
            lambdas.

Diff:
---
 gcc/cp/parser.cc | 22 ++--------------------
 1 file changed, 2 insertions(+), 20 deletions(-)

diff --git a/gcc/cp/parser.cc b/gcc/cp/parser.cc
index ad717f73e3b..15bba450985 100644
--- a/gcc/cp/parser.cc
+++ b/gcc/cp/parser.cc
@@ -30565,7 +30565,8 @@ cp_parser_lookup_name (cp_parser *parser, tree name,
 
       /* Look up the name in the scope of the OBJECT_TYPE, unless the
 	 OBJECT_TYPE is not a class.  */
-      if (!dep && CLASS_TYPE_P (object_type))
+      if (CLASS_TYPE_P (object_type)
+	  && !(dep && LAMBDA_TYPE_P (object_type)))
 	/* If the OBJECT_TYPE is a template specialization, it may
 	   be instantiated during name lookup.  In that case, errors
 	   may be issued.  Even if we rollback the current tentative
@@ -30589,25 +30590,6 @@ cp_parser_lookup_name (cp_parser *parser, tree name,
 			    : is_template ? LOOK_want::TYPE
 			    : prefer_type_arg (tag_type));
 
-      /* If we did unqualified lookup of a dependent member-qualified name and
-	 found something, do we want to use it?  P1787 clarified that we need
-	 to look in the object scope first even if it's dependent, but for now
-	 let's still use it in some cases.
-	 FIXME remember unqualified lookup result to use if member lookup fails
-	 at instantiation time.	 */
-      if (decl && dep && is_template)
-	{
-	  saved_token_sentinel toks (parser->lexer, STS_ROLLBACK);
-	  /* Only use the unqualified class template lookup if we're actually
-	     looking at a template arg list.  */
-	  if (!cp_parser_skip_entire_template_parameter_list (parser))
-	    decl = NULL_TREE;
-	  /* And only use the unqualified lookup if we're looking at ::.  */
-	  if (decl
-	      && !cp_lexer_next_token_is (parser->lexer, CPP_SCOPE))
-	    decl = NULL_TREE;
-	}
-
       /* If we know we're looking for a type (e.g. A in p->A::x),
 	 mock up a typename.  */
       if (!decl && object_type && tag_type != none_type


                 reply	other threads:[~2022-07-01 15:42 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=20220701154241.E7A133858D28@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).