gnu/gcc/9b0341a7a6a38912e667982003bcbfebdfb86335 c++: testsuite: Add some opt/is_constant_evaluated3.C variants
r13-6422 added opt/is_constant_evaluated3.C to verify that we constant
fold copy-init such as a1. (Later, r14-6506 enabled constant folding of
the a2-a5 inits.) r13-6422 turns out to trigger a latent bug and causes
PR c++/126483, premature folding of is_constant_evaluated in copy-init
inside a lambda scope.
This patch adds a couple extra variants of this test, one where the
containing function is constexpr (3a) and one where it's a lambda (3b).
The new 3a.C demonstrates however that we still don't constant fold a1's
copy-init when inside a constexpr function scope. 3b.C demonstrates that
we do fold it when inside a (maybe-constexpr) lambda scope.
gcc/testsuite/ChangeLog:
* g++.dg/opt/is_constant_evaluated3a.C: New test.
* g++.dg/opt/is_constant_evaluated3b.C: New test.
Reviewed-by: Jason Merrill <jason@redhat.com>
2 files changed