aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/constraint.cc
diff options
context:
space:
mode:
authorPatrick Palka <ppalka@redhat.com>2020-09-19 11:17:41 -0400
committerPatrick Palka <ppalka@redhat.com>2020-09-19 11:17:41 -0400
commitdea470d09155f2007bdd502c16614128cb6f9348 (patch)
tree834719a35164db0c246a1e4addb2f00b2495f84b /gcc/cp/constraint.cc
parent83858ba1db31cd83667592a41d71315090459da4 (diff)
downloadgcc-dea470d09155f2007bdd502c16614128cb6f9348.zip
gcc-dea470d09155f2007bdd502c16614128cb6f9348.tar.gz
gcc-dea470d09155f2007bdd502c16614128cb6f9348.tar.bz2
c++: std::is_constant_evaluated inside constraint [PR97051]
According to [expr.const]/14, the result of substitution into an atomic constraint is manifestly constant-evaluated; this patch adjusts the call to maybe_constant_value in satisfy_atom to that effect. gcc/cp/ChangeLog: PR c++/97051 * constraint.cc (satisfy_atom): Pass true as the manifestly_const_eval argument to maybe_constant_value. gcc/testsuite/ChangeLog: PR c++/97051 * g++.dg/cpp2a/is-constant-evaluated11.C: New test.
Diffstat (limited to 'gcc/cp/constraint.cc')
-rw-r--r--gcc/cp/constraint.cc3
1 files changed, 2 insertions, 1 deletions
diff --git a/gcc/cp/constraint.cc b/gcc/cp/constraint.cc
index 0aab307..8137df5 100644
--- a/gcc/cp/constraint.cc
+++ b/gcc/cp/constraint.cc
@@ -2643,7 +2643,8 @@ satisfy_atom (tree t, tree args, subst_info info)
result = cxx_constant_value (result);
else
{
- result = maybe_constant_value (result);
+ result = maybe_constant_value (result, NULL_TREE,
+ /*manifestly_const_eval=*/true);
if (!TREE_CONSTANT (result))
result = error_mark_node;
}