]> git.ipfire.org Git - thirdparty/gcc.git/commit
c++: lambda convop in C++23 [PR114632]
authorJason Merrill <jason@redhat.com>
Thu, 24 Jul 2025 18:07:11 +0000 (14:07 -0400)
committerJason Merrill <jason@redhat.com>
Thu, 24 Jul 2025 18:07:11 +0000 (14:07 -0400)
commiteb59e58dcc4cdf36b8b2d4e1654fe4fa062b5bef
treeac3d039b70b65cd8e7a6e7179bfa4729a54d7d46
parent44e32178031e89399710c3ee7444891631a9c8ec
c++: lambda convop in C++23 [PR114632]

The lambda conversion was ICEing for two C++23 features, static op() and
explicit object parameters.  The issue with the former seems like a more
general issue: tsubst_function_decl recursing to substitute the parameters
was affected by cp_unevaluated_operand from the decltype that refers to the
declaration.  Various places already make a point of clearing
cp_unevaluated_operand ahead of PARM_DECL tsubsting; doing it here makes the
PR101233 fix redundant.

For explicit object lambdas, we want to implement CWG2561 and
just not declare the conversion.

PR c++/114632
PR c++/101233

gcc/cp/ChangeLog:

* lambda.cc (maybe_add_lambda_conv_op): Not for xobj lambda.
* pt.cc (tsubst_function_decl): Add cp_evaluated.
(alias_ctad_tweaks): Revert PR101233 fix.

gcc/testsuite/ChangeLog:

* g++.dg/cpp23/explicit-obj-lambda18.C: New test.
* g++.dg/cpp23/static-operator-call7.C: New test.
gcc/cp/lambda.cc
gcc/cp/pt.cc
gcc/testsuite/g++.dg/cpp23/explicit-obj-lambda18.C [new file with mode: 0644]
gcc/testsuite/g++.dg/cpp23/static-operator-call7.C [new file with mode: 0644]