[libcxx-commits] [libcxx] [libc++][span] LWG4243: `as_bytes`/`as_writable_bytes` is broken with `span<volatile T>` (PR #200993)

A. Jiang via libcxx-commits libcxx-commits at lists.llvm.org
Tue Jun 2 01:32:41 PDT 2026


================
@@ -44,6 +49,30 @@ struct A {};
 int iArr2[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
 
 int main(int, char**) {
+  static_assert(hasAsBytes<int>());
+  static_assert(hasAsBytes<long>());
+  static_assert(hasAsBytes<double>());
+  static_assert(hasAsBytes<A>());
+  static_assert(hasAsBytes<std::string>());
+
+  static_assert(hasAsBytes<const int>());
+  static_assert(hasAsBytes<const long>());
+  static_assert(hasAsBytes<const double>());
+  static_assert(hasAsBytes<const A>());
+  static_assert(hasAsBytes<const std::string>());
+
+  static_assert(hasAsBytes<int, 0>());
+  static_assert(hasAsBytes<long, 0>());
+  static_assert(hasAsBytes<double, 0>());
+  static_assert(hasAsBytes<A, 0>());
+  static_assert(hasAsBytes<std::string, 0>());
+
+  static_assert(hasAsBytes<const int, 0>());
+  static_assert(hasAsBytes<const long, 0>());
+  static_assert(hasAsBytes<const double, 0>());
+  static_assert(hasAsBytes<const A, 0>());
+  static_assert(hasAsBytes<const std::string, 0>());
+
----------------
frederick-vs-ja wrote:

> Can we test the 'false' cases in the pass test, and remove the verify test?

Yeah. I think this is conventional.

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


More information about the libcxx-commits mailing list