================
@@ -18,6 +30,38 @@ void f(B b) {
 struct D : B {};
 } // namespace cwg2718
 
+namespace cwg2749 { // cwg2749: 19
+
+extern int x[2];
+struct Y {
+  int i;
+  int j;
+};
+extern Y y[2];
+
+#if __cplusplus >= 201103L
+static_assert(static_cast<void*>(x + 0) < static_cast<void*>(x + 1), "");
+static_assert(static_cast<void*>(&y[0].i) < static_cast<void*>(&y[0].j), "");
+static_assert(static_cast<void*>(&y[0].j) < static_cast<void*>(&y[1].i), "");
+#else
+enum X {
+  a = static_cast<void*>(x + 0) < static_cast<void*>(x + 1),
----------------
MitalAshok wrote:

C++98 has a separate test because `_Static_assert` doesn't constant fold its 
arguments in C++ (only in C as an extension), and in C++98 ยง6.4 "Constant 
expressions" "an *integral constant expression* shall have integral type and 
shall only have operands that are integer constants, enumeration constants, 
character constants, `sizeof` expressions, and floating constants that are the 
immediate operands of cast", causing `static_assert((x + 0) < (x + 1))` to fail 
because it has address operands.

On second thought, this change only applies in C++98 when we do constant 
folding as an extension. I don't think we need to test that a now-non-existent 
warning isn't issued in C++98 mode when we use an extension, so I'll just get 
rid of the C++98 test

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

Reply via email to