]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
c++: lambda capture dependent type [PR82980]
authorJason Merrill <jason@redhat.com>
Thu, 14 Apr 2022 18:09:13 +0000 (14:09 -0400)
committerJason Merrill <jason@redhat.com>
Fri, 29 Apr 2022 21:24:05 +0000 (17:24 -0400)
The stage 4 patch limited direct propagation of dependent type to capture
field/proxy to the "current instantiation", but many more types should be
suitable as well.

PR c++/82980

gcc/cp/ChangeLog:

* lambda.cc (type_deducible_expression_p): Allow more types.

gcc/cp/lambda.cc

index 65579edc316d91e217551edcaaa13ae55add40a1..10834d6b14312dc866d9c7dc2770408f4f266d7f 100644 (file)
@@ -195,10 +195,9 @@ type_deducible_expression_p (tree expr)
       || TREE_CODE (expr) == EXPR_PACK_EXPANSION)
     return false;
   tree t = non_reference (TREE_TYPE (expr));
-  if (!t) return false;
-  while (TREE_CODE (t) == POINTER_TYPE)
-    t = TREE_TYPE (t);
-  return currently_open_class (t);
+  return (t && TREE_CODE (t) != TYPE_PACK_EXPANSION
+         && !WILDCARD_TYPE_P (t) && !LAMBDA_TYPE_P (t)
+         && !type_uses_auto (t));
 }
 
 /* Returns the type to use for the FIELD_DECL corresponding to the