diff options
author | Jason Merrill <jason@redhat.com> | 2022-04-14 14:09:13 -0400 |
---|---|---|
committer | Jason Merrill <jason@redhat.com> | 2022-04-29 17:24:05 -0400 |
commit | 53e7252140c95afc859ade521a61ab4115d7fb11 (patch) | |
tree | 4b0abed6452ad8e4f080bf9e8baf826e8aeed480 /gcc | |
parent | 8189838d823ea65e560c573d38a65edc12f5c2e3 (diff) | |
download | gcc-53e7252140c95afc859ade521a61ab4115d7fb11.zip gcc-53e7252140c95afc859ade521a61ab4115d7fb11.tar.gz gcc-53e7252140c95afc859ade521a61ab4115d7fb11.tar.bz2 |
c++: lambda capture dependent type [PR82980]
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.
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/lambda.cc | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/gcc/cp/lambda.cc b/gcc/cp/lambda.cc index 65579ed..10834d6 100644 --- a/gcc/cp/lambda.cc +++ b/gcc/cp/lambda.cc @@ -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 |