c++: maybe_constant_init and unevaluated operands [PR109030]
commit31cdfdef04701e10cffcec4578b2337684f0e4bc
authorPatrick Palka <ppalka@redhat.com>
Thu, 16 Mar 2023 18:47:43 +0000 (16 14:47 -0400)
committerPatrick Palka <ppalka@redhat.com>
Thu, 16 Mar 2023 18:47:43 +0000 (16 14:47 -0400)
tree81e471cb3f4b83772bfb63559f433e5908f3049e
parentc630157fd01140dbce120c1409c413a97dc17104
c++: maybe_constant_init and unevaluated operands [PR109030]

This testcase in this PR (already fixed by r13-6526-ge4692319fd5fc7)
demonstrates that maybe_constant_init can be called on an unevaluated
operand (e.g. from massage_init_elt) so this entry point should also
limit constant evaluation in that case, like maybe_constant_value does.

PR c++/109030

gcc/cp/ChangeLog:

* constexpr.cc (maybe_constant_init_1): For an unevaluated
non-manifestly-constant operand, don't constant evaluate
and instead call fold_to_constant as in maybe_constant_value.

gcc/testsuite/ChangeLog:

* g++.dg/cpp2a/constexpr-inst2.C: New test.
gcc/cp/constexpr.cc
gcc/testsuite/g++.dg/cpp2a/constexpr-inst2.C [new file with mode: 0644]