r = TARGET_EXPR_INITIAL (r);
}
+ /* uid_sensitive_constexpr_evaluation_value restricts warning-dependent
+ constexpr evaluation to avoid unnecessary template instantiation, and is
+ always done with mce_unknown. But due to gaps in the restriction logic
+ we may still end up taking an evaluation path that in turn requires
+ manifestly constant evaluation, and such evaluation must not be
+ restricted since it likely has semantic consequences.
+ TODO: Remove/replace the mechanism in GCC 17. */
+ auto uids = make_temp_override (uid_sensitive_constexpr_evaluation_value);
+ if (ctx.manifestly_const_eval == mce_true)
+ uid_sensitive_constexpr_evaluation_value = false;
+
auto_vec<tree, 16> cleanups;
global_ctx.cleanups = &cleanups;
--- /dev/null
+// PR c++/122494
+// { dg-do compile { target c++20 } }
+
+template<class T>
+concept C = false;
+
+template<class T> requires (!C<T>)
+struct A {
+ static constexpr unsigned v = 0;
+};
+
+template<class T>
+struct B {
+ static constexpr unsigned v = A<T>::v;
+
+ constexpr static bool f() {
+ return [](auto) {
+ if (v == 0) { }
+ return true;
+ }(0);
+ }
+};
+
+static_assert(B<int>::f());
--- /dev/null
+// PR c++/123814
+// { dg-do compile { target c++20 } }
+// { dg-additional-options "-Wall --param ggc-min-expand=0 --param ggc-min-heapsize=0" }
+
+namespace std {
+ struct source_location {
+ struct __impl {
+ const char *_M_file_name;
+ const char *_M_function_name;
+ unsigned _M_line;
+ unsigned _M_column;
+ };
+ static void current(const __impl* = __builtin_source_location());
+ };
+} // namespace std
+
+template <typename> concept same_as = true;
+
+template <typename... Us>
+concept one_of = (same_as<Us> || ...);
+
+template <one_of<> T> constexpr int buffer_size_for_int = 0;
+template <> constexpr int buffer_size_for_int<int> = 1;
+
+template <int> using Basic_Characters = int;
+
+template <typename T>
+Basic_Characters<buffer_size_for_int<T>> to_characters() {
+ std::source_location::current();
+} // { dg-warning "return statement" }
+
+void go() {
+ to_characters<int>();
+}