[libcxx-commits] [libcxx] [libc++][test] Fixes constexpr nasty_char_traits. (PR #90981)
Louis Dionne via libcxx-commits
libcxx-commits at lists.llvm.org
Tue May 7 08:53:47 PDT 2024
================
@@ -16,6 +16,30 @@
#include "test_macros.h"
+// Tests whether the range [p1, p1 + n) overlaps with the range [p2, p2 + n).
+//
+// precondition The ranges [p1, p1 + n) and [p2, p2 + n) are valid ranges.
+//
+// Typically the pointers are compared with less than. This is not allowed when
+// the pointers belong to different ranges. This is UB. Typically, this is
+// benign at run-time, however since UB is not allowed during constant
+// evaluation this does not compile. This function does the validation without
+// UB.
+//
+// When the ranges overlap the ranges can be copied from the beginning to the
----------------
ldionne wrote:
```suggestion
// When the ranges overlap they can be copied from the beginning to the
```
https://github.com/llvm/llvm-project/pull/90981
More information about the libcxx-commits
mailing list