c++: simpler fix for PR106024
authorJason Merrill <jason@redhat.com>
Fri, 1 Jul 2022 15:02:54 +0000 (11:02 -0400)
committerSlava Barinov <v.barinov@samsung.com>
Thu, 27 Apr 2023 09:06:03 +0000 (12:06 +0300)
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.

gcc/cp/parser.cc

index a6341b9..1b19888 100644 (file)
@@ -31315,7 +31315,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