[libcxx-commits] [libcxx] [libcxx] Recalculate union-member sizes in basic_string (PR #168742)

Simon Tatham via libcxx-commits libcxx-commits at lists.llvm.org
Thu Nov 20 05:57:40 PST 2025


================
@@ -0,0 +1,114 @@
+#include <stdint.h>
+#include <string>
+#include <algorithm>
+#include <cassert>
+
+#include "test_macros.h"
+
+template<typename Char>
+void test_string() {
+  // Make a test string.
+  std::basic_string<Char> s;
+  LIBCPP_ASSERT(s.size() == 0);
----------------
statham-arm wrote:

The other test I was modifying used `LIBCPP_ASSERT`, and I assumed that was local convention in libc++ tests. But now I look more closely, the purpose of `LIBCPP_ASSERT` seems to be to switch between runtime and static assertions, and this test isn't trying to do anything static at compile time.

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


More information about the libcxx-commits mailing list