diff --git a/clang/test/CXX/expr/expr.const/p6-2a.cpp b/clang/test/CXX/expr/expr.const/p6-2a.cpp --- a/clang/test/CXX/expr/expr.const/p6-2a.cpp +++ b/clang/test/CXX/expr/expr.const/p6-2a.cpp @@ -41,3 +41,16 @@ } }; constexpr Temporary t = {3}; // expected-error {{must have constant destruction}} expected-note {{created here}} expected-note {{in call}} + +namespace P1073R3 { +consteval int f() { return 42; } // expected-note 3 {{declared here}} +consteval auto g() { return f; } +// FIXME: there should be no diagnostics associated with either h() or r. +consteval int h(int (*p)() = g()) { return p(); } // expected-error {{call to consteval function 'P1073R3::g' is not a constant expression}} \ + expected-note {{declared here}} \ + expected-note {{pointer to a consteval declaration is not a constant expression}} +constexpr int r = h(); // expected-note {{in the default initalizer of 'p'}} +constexpr auto e = g(); // expected-error {{call to consteval function 'P1073R3::g' is not a constant expression}} \ + expected-error {{constexpr variable 'e' must be initialized by a constant expression}} \ + expected-note 2 {{pointer to a consteval declaration is not a constant expression}} +} // namespace P1073R3 diff --git a/clang/test/CXX/expr/expr.const/p8-2a.cpp b/clang/test/CXX/expr/expr.const/p8-2a.cpp new file mode 100644 --- /dev/null +++ b/clang/test/CXX/expr/expr.const/p8-2a.cpp @@ -0,0 +1,22 @@ +// RUN: %clang_cc1 -std=c++20 -verify %s + +// expected-no-diagnostics + +namespace P1073R3 { +struct N { + constexpr N() {} + N(N const&) = delete; +}; + +template constexpr void bad_assert_copyable() { T t; T t2 = t; } +using ineffective = decltype(bad_assert_copyable()); + +// bad_assert_copyable is not needed for constant evaluation +// (and thus not instantiated) +template consteval void assert_copyable() { T t; T t2 = t; } +using check = decltype(assert_copyable()); +// FIXME: this should give an error because assert_copyable is instantiated +// (because it is needed for constant evaluation), but the attempt to copy t is +// ill-formed. +} // namespace P1073R3 + diff --git a/clang/www/cxx_status.html b/clang/www/cxx_status.html --- a/clang/www/cxx_status.html +++ b/clang/www/cxx_status.html @@ -1120,7 +1120,14 @@ Immediate functions (consteval) P1073R3 - Clang 15 + +
Clang 15 (Partial) + Clang still incorrectly defers some consteval executions to runtime, + resulting in CodeGen crashes. Additionally, Clang does not properly + handle default arguments in consteval functions under all + circumstances. +
+ P1937R2