[clang] [Clang] Implement P2280R4 Using unknown pointers and references in constant expressions (PR #95474)

via cfe-commits cfe-commits at lists.llvm.org
Sat Dec 28 01:54:04 PST 2024


================
@@ -1961,7 +1961,8 @@ namespace ConstexprConstructorRecovery {
 
 namespace Lifetime {
   void f() {
-    constexpr int &n = n; // expected-error {{constant expression}} expected-note {{use of reference outside its lifetime}} expected-warning {{not yet bound to a value}}
+    constexpr int &n = n; // expected-error {{constant expression}} cxx23-note {{reference to 'n' is not a constant expression}} cxx23-note {{address of non-static constexpr variable 'n' may differ}} expected-warning {{not yet bound to a value}}
+                          // cxx11_20-note at -1 {{use of reference outside its lifetime is not allowed in a constant expression}}
----------------
cor3ntin wrote:

@shafik 

https://github.com/llvm/llvm-project/pull/95474


More information about the cfe-commits mailing list