================
@@ -0,0 +1,30 @@
+// RUN: %clang_cc1 -std=c++2c -verify %s
+
+namespace dr2798 { // dr2798: 17 drafting
+#if __cpp_static_assert >= 202306
+struct string {
+    constexpr string() {
+        data_ = new char[6]();
+        __builtin_memcpy(data_, "Hello", 5);
+        data_[5] = 0;
+    }
+    constexpr ~string() {
+        delete[] data_;
+    }
+    constexpr unsigned long size() const {
+        return 5;
+    };
+    constexpr const char* data() const {
+        return data_;
+    }
+
+    char* data_;
+};
+struct X {
+    string s;
+};
+consteval X f() { return {}; }
+
+static_assert(false, f().s); // expected-error {{static assertion failed: 
Hello}}
----------------
AaronBallman wrote:

FWIW, I have a slight preference for the current form (and always do). `-1` or 
`+1` isn't the end of the world, but having the diagnostic on the line which it 
fires requires the least amount of thinking when reading the code.

https://github.com/llvm/llvm-project/pull/73234
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to