summaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
authorPatrick Palka <ppalka@redhat.com>2020-05-23 14:39:28 -0400
committerPatrick Palka <ppalka@redhat.com>2020-05-23 14:39:28 -0400
commit6d1556ecfae3eff010ef7dc15f3da998403fa196 (patch)
tree97e25bb6e9824b291ae5e5bd1cfc0be8a18596ca /gcc/cp
parent3cb0c7cc160a50f830bfa9aa5a3264b773a28bf8 (diff)
c++: Avoid concept evaluation when uid-sensitive [PR94038]
Concept evaluation may entail DECL_UID generation and/or template instantiation, so in general we can't perform it during uid-sensitive constexpr evaluation. gcc/cp/ChangeLog: PR c++/94038 * constexpr.c (cxx_eval_constant_expression) <case TEMPLATE_ID_EXPR>: Don't evaluate the concept when constexpr evaluation is uid-sensitive. gcc/testsuite/ChangeLog: PR c++/94038 * g++.dg/warn/pr94038-3.C: New test.
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/ChangeLog7
-rw-r--r--gcc/cp/constexpr.c3
2 files changed, 9 insertions, 1 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 385bfcd72db..2feeb12bcb0 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,10 @@
+2020-05-23 Patrick Palka <ppalka@redhat.com>
+
+ PR c++/94038
+ * constexpr.c (cxx_eval_constant_expression)
+ <case TEMPLATE_ID_EXPR>: Don't evaluate the concept when
+ constexpr evaluation is uid-sensitive.
+
2020-05-21 Patrick Palka <ppalka@redhat.com>
PR c++/94038
diff --git a/gcc/cp/constexpr.c b/gcc/cp/constexpr.c
index 98c974e657f..4e441ac8d2f 100644
--- a/gcc/cp/constexpr.c
+++ b/gcc/cp/constexpr.c
@@ -6486,7 +6486,8 @@ cxx_eval_constant_expression (const constexpr_ctx *ctx, tree t,
break;
}
- if (!processing_template_decl)
+ if (!processing_template_decl
+ && !uid_sensitive_constexpr_evaluation_p ())
r = evaluate_concept_check (t, tf_warning_or_error);
else
*non_constant_p = true;