[libcxx-commits] [libcxx] [libc++] Fix tests on musl (#85085) (PR #86934)

Mark de Wever via libcxx-commits libcxx-commits at lists.llvm.org
Thu Mar 28 10:10:23 PDT 2024


================
@@ -8934,11 +8935,12 @@ void test4()
     char str[200];
     std::locale lc = std::locale::classic();
     std::locale lg(lc, new my_numpunct);
-#ifdef _AIX
-    std::string inf = "INF";
-#else
-    std::string inf = "inf";
-#endif
+
+    std::string inf;
+
+    // This should match the underlying C library
+    std::sprintf(str, "%f", INFINITY);
+    inf = str;
----------------
mordante wrote:

```suggestion
    // This should match the underlying C library
    std::sprintf(str, "%f", INFINITY);
    std::string inf = str;
```
This feels more C++ like to me, same below.

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


More information about the libcxx-commits mailing list