[libcxx-commits] [libcxx] [libc++] Mark LWG4084 as resolved (PR #206224)

A. Jiang via libcxx-commits libcxx-commits at lists.llvm.org
Sun Jun 28 08:57:31 PDT 2026


================
@@ -14281,13 +14281,62 @@ void test6() {
   }
 }
 
+void test7() {
+  char str[200];
+  std::locale lc = std::locale::classic();
+  const my_facet f(1);
+
+  {
+    double v = INFINITY;
+    std::ios ios(0);
+    std::fixed(ios);
+    ios.imbue(lc);
+
+    {
+      std::nouppercase(ios);
+      cpp17_output_iterator<char*> iter = f.put(cpp17_output_iterator<char*>(str), ios, '*', v);
+      std::string ex(str, base(iter));
+      assert(ex.substr(0, 3) == "inf");
+    }
+    {
+      std::uppercase(ios);
+      cpp17_output_iterator<char*> iter = f.put(cpp17_output_iterator<char*>(str), ios, '*', v);
+      std::string ex(str, base(iter));
+      assert(ex.substr(0, 3) == "INF");
+    }
+  }
+
+  {
+    double v = NAN;
+    std::ios ios(0);
+    std::fixed(ios);
+    ios.imbue(lc);
+
+    {
+      std::nouppercase(ios);
+      cpp17_output_iterator<char*> iter = f.put(cpp17_output_iterator<char*>(str), ios, '*', v);
+      std::string ex(str, base(iter));
+      assert(ex.substr(0, 3) == "nan");
+    }
+    {
+      std::uppercase(ios);
+      cpp17_output_iterator<char*> iter = f.put(cpp17_output_iterator<char*>(str), ios, '*', v);
+      std::string ex(str, base(iter));
+      assert(ex.substr(0, 3) == "NAN");
+    }
+  }
+}
+
 int main(int, char**) {
   test1();
   test2();
   test3();
   test4();
   test5();
   test6();
+#if !defined(_AIX)
----------------
frederick-vs-ja wrote:

LGTM with comment added. I think it's a bit better to add `TODO` comment here. Same for `put_long_double_pass.cpp`.

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


More information about the libcxx-commits mailing list