[clang] [Clang] CWG2749: relational operators involving pointers to void (PR #93046)
Vlad Serebrennikov via cfe-commits
cfe-commits at lists.llvm.org
Thu May 30 12:59:01 PDT 2024
================
@@ -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),
----------------
Endilll wrote:
You should copy over the C++98 "backport" of `static_assert` from e.g. (we use it liberally across DR test suite)
https://github.com/llvm/llvm-project/blob/0eb9e021b15f477b796a6aaed94c94887f19171c/clang/test/CXX/drs/cwg1xx.cpp#L8-L11
https://github.com/llvm/llvm-project/pull/93046
More information about the cfe-commits
mailing list