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.
+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
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;
+2020-05-23 Patrick Palka <ppalka@redhat.com>
+
+ PR c++/94038
+ * g++.dg/warn/pr94038-3.C: New test.
+
2020-05-22 Mark Wielaard <mark@klomp.org>
* gcc.dg/spellcheck-stdint.c: New test.
--- /dev/null
+// PR c++/94038
+// { dg-do compile { target c++20 } }
+// { dg-additional-options "-Wall" }
+
+template<typename T>
+constexpr int foo() {
+ return T::x;
+}
+
+constexpr bool bar(bool a) { return a; }
+
+template<typename T>
+concept C = foo<T>() == 0;
+
+static_assert(decltype(bar(C<int>)){} == false);