[libcxx-commits] [libcxx] [libc++][format] Discard contents since null-terminator in character arrays in formatting (PR #116571)

A. Jiang via libcxx-commits libcxx-commits at lists.llvm.org
Sat Feb 22 01:06:49 PST 2025


================
@@ -3189,6 +3189,12 @@ void format_tests(TestFunction check, ExceptionTest check_exception) {
     const CharT* data = buffer;
     check(SV("hello 09azAZ!"), SV("hello {}"), data);
   }
+  {
+    // https://github.com/llvm/llvm-project/issues/115935
+    // Contents after the embedded null character are discarded.
+    CharT buffer[] = {CharT('a'), CharT('b'), CharT('c'), 0, CharT('d'), CharT('e'), CharT('f'), 0};
----------------
frederick-vs-ja wrote:

Added.

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


More information about the libcxx-commits mailing list