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

Connector Switch via libcxx-commits libcxx-commits at lists.llvm.org
Sat Jun 27 01:08:37 PDT 2026


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

>From fc715f8eabfe5ab62f91c0833022f061bdbf641c Mon Sep 17 00:00:00 2001
From: c8ef <c8ef at outlook.com>
Date: Sat, 27 Jun 2026 14:57:15 +0800
Subject: [PATCH 1/3] [libc++] Mark lwg4084 as resolved

---
 libcxx/docs/Status/Cxx26Issues.csv            |  2 +-
 .../facet.num.put.members/lwg4084.pass.cpp    | 65 +++++++++++++++++++
 2 files changed, 66 insertions(+), 1 deletion(-)
 create mode 100644 libcxx/test/std/localization/locale.categories/category.numeric/locale.nm.put/facet.num.put.members/lwg4084.pass.cpp

diff --git a/libcxx/docs/Status/Cxx26Issues.csv b/libcxx/docs/Status/Cxx26Issues.csv
index d4f7a44910e00..9b764f2c32377 100644
--- a/libcxx/docs/Status/Cxx26Issues.csv
+++ b/libcxx/docs/Status/Cxx26Issues.csv
@@ -88,7 +88,7 @@
 "`LWG4044 <https://wg21.link/LWG4044>`__","Confusing requirements for ``std::print`` on POSIX platforms","2024-11 (Wrocław)","","","`#118343 <https://github.com/llvm/llvm-project/issues/118343>`__",""
 "`LWG4064 <https://wg21.link/LWG4064>`__","Clarify that ``std::launder`` is not needed when using the result of ``std::memcpy``","2024-11 (Wrocław)","","","`#118344 <https://github.com/llvm/llvm-project/issues/118344>`__",""
 "`LWG4072 <https://wg21.link/LWG4072>`__","``std::optional`` comparisons: constrain harder","2024-11 (Wrocław)","","","`#118345 <https://github.com/llvm/llvm-project/issues/118345>`__",""
-"`LWG4084 <https://wg21.link/LWG4084>`__","``std::fixed`` ignores ``std::uppercase``","2024-11 (Wrocław)","","","`#118346 <https://github.com/llvm/llvm-project/issues/118346>`__",""
+"`LWG4084 <https://wg21.link/LWG4084>`__","``std::fixed`` ignores ``std::uppercase``","2024-11 (Wrocław)","|Complete|","","`#118346 <https://github.com/llvm/llvm-project/issues/118346>`__",""
 "`LWG4085 <https://wg21.link/LWG4085>`__","``ranges::generate_random``'s helper lambda should specify the return type","2024-11 (Wrocław)","","","`#118347 <https://github.com/llvm/llvm-project/issues/118347>`__",""
 "`LWG4088 <https://wg21.link/LWG4088>`__","``println`` ignores the locale imbued in ``std::ostream``","2024-11 (Wrocław)","|Complete|","18","`#118348 <https://github.com/llvm/llvm-project/issues/118348>`__",""
 "`LWG4112 <https://wg21.link/LWG4112>`__","``has-arrow`` should required ``operator->()`` to be ``const``-qualified","2024-11 (Wrocław)","","","`#118349 <https://github.com/llvm/llvm-project/issues/118349>`__",""
diff --git a/libcxx/test/std/localization/locale.categories/category.numeric/locale.nm.put/facet.num.put.members/lwg4084.pass.cpp b/libcxx/test/std/localization/locale.categories/category.numeric/locale.nm.put/facet.num.put.members/lwg4084.pass.cpp
new file mode 100644
index 0000000000000..5769c8c14066e
--- /dev/null
+++ b/libcxx/test/std/localization/locale.categories/category.numeric/locale.nm.put/facet.num.put.members/lwg4084.pass.cpp
@@ -0,0 +1,65 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// class num_put<charT, OutputIterator>
+
+// LWG4084: std::fixed ignores std::uppercase
+
+#include <cassert>
+#include <ios>
+#include <limits>
+#include <locale>
+#include <string>
+
+#include "test_iterators.h"
+
+typedef std::num_put<char, cpp17_output_iterator<char*> > Facet;
+
+class my_facet : public Facet {
+public:
+  explicit my_facet(std::size_t refs = 0) : Facet(refs) {}
+};
+
+template <class T>
+std::string put(T value, std::ios_base& ios) {
+  char str[100];
+  const my_facet f(1);
+  cpp17_output_iterator<char*> iter = f.put(cpp17_output_iterator<char*>(str), ios, '*', value);
+  return std::string(str, base(iter));
+}
+
+bool is_lowercase_infinity(const std::string& str) { return str == "inf" || str == "infinity"; }
+
+bool is_uppercase_infinity(const std::string& str) { return str == "INF" || str == "INFINITY"; }
+
+template <class T>
+void test() {
+  {
+    std::ios ios(0);
+    std::fixed(ios);
+    std::nouppercase(ios);
+
+    assert(is_lowercase_infinity(put(std::numeric_limits<T>::infinity(), ios)));
+  }
+  {
+    std::ios ios(0);
+    std::fixed(ios);
+    std::uppercase(ios);
+
+    assert(is_uppercase_infinity(put(std::numeric_limits<T>::infinity(), ios)));
+  }
+}
+
+int main(int, char**) {
+  test<double>();
+  test<long double>();
+
+  return 0;
+}

>From a6fc84d51b3dd5244ed74f4a3966267447376b00 Mon Sep 17 00:00:00 2001
From: c8ef <c8ef at outlook.com>
Date: Sat, 27 Jun 2026 15:56:38 +0800
Subject: [PATCH 2/3] address review comments

---
 .../facet.num.put.members/lwg4084.pass.cpp    | 65 -------------------
 .../facet.num.put.members/put_double.pass.cpp | 47 ++++++++++++++
 .../put_long_double.pass.cpp                  | 47 ++++++++++++++
 3 files changed, 94 insertions(+), 65 deletions(-)
 delete mode 100644 libcxx/test/std/localization/locale.categories/category.numeric/locale.nm.put/facet.num.put.members/lwg4084.pass.cpp

diff --git a/libcxx/test/std/localization/locale.categories/category.numeric/locale.nm.put/facet.num.put.members/lwg4084.pass.cpp b/libcxx/test/std/localization/locale.categories/category.numeric/locale.nm.put/facet.num.put.members/lwg4084.pass.cpp
deleted file mode 100644
index 5769c8c14066e..0000000000000
--- a/libcxx/test/std/localization/locale.categories/category.numeric/locale.nm.put/facet.num.put.members/lwg4084.pass.cpp
+++ /dev/null
@@ -1,65 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-// <locale>
-
-// class num_put<charT, OutputIterator>
-
-// LWG4084: std::fixed ignores std::uppercase
-
-#include <cassert>
-#include <ios>
-#include <limits>
-#include <locale>
-#include <string>
-
-#include "test_iterators.h"
-
-typedef std::num_put<char, cpp17_output_iterator<char*> > Facet;
-
-class my_facet : public Facet {
-public:
-  explicit my_facet(std::size_t refs = 0) : Facet(refs) {}
-};
-
-template <class T>
-std::string put(T value, std::ios_base& ios) {
-  char str[100];
-  const my_facet f(1);
-  cpp17_output_iterator<char*> iter = f.put(cpp17_output_iterator<char*>(str), ios, '*', value);
-  return std::string(str, base(iter));
-}
-
-bool is_lowercase_infinity(const std::string& str) { return str == "inf" || str == "infinity"; }
-
-bool is_uppercase_infinity(const std::string& str) { return str == "INF" || str == "INFINITY"; }
-
-template <class T>
-void test() {
-  {
-    std::ios ios(0);
-    std::fixed(ios);
-    std::nouppercase(ios);
-
-    assert(is_lowercase_infinity(put(std::numeric_limits<T>::infinity(), ios)));
-  }
-  {
-    std::ios ios(0);
-    std::fixed(ios);
-    std::uppercase(ios);
-
-    assert(is_uppercase_infinity(put(std::numeric_limits<T>::infinity(), ios)));
-  }
-}
-
-int main(int, char**) {
-  test<double>();
-  test<long double>();
-
-  return 0;
-}
diff --git a/libcxx/test/std/localization/locale.categories/category.numeric/locale.nm.put/facet.num.put.members/put_double.pass.cpp b/libcxx/test/std/localization/locale.categories/category.numeric/locale.nm.put/facet.num.put.members/put_double.pass.cpp
index b131a41ceac34..a3c5e9d9ea799 100644
--- a/libcxx/test/std/localization/locale.categories/category.numeric/locale.nm.put/facet.num.put.members/put_double.pass.cpp
+++ b/libcxx/test/std/localization/locale.categories/category.numeric/locale.nm.put/facet.num.put.members/put_double.pass.cpp
@@ -14281,6 +14281,52 @@ 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();
@@ -14288,6 +14334,7 @@ int main(int, char**) {
   test4();
   test5();
   test6();
+  test7();
 
   return 0;
 }
diff --git a/libcxx/test/std/localization/locale.categories/category.numeric/locale.nm.put/facet.num.put.members/put_long_double.pass.cpp b/libcxx/test/std/localization/locale.categories/category.numeric/locale.nm.put/facet.num.put.members/put_long_double.pass.cpp
index d044898a1f828..f6479be54c192 100644
--- a/libcxx/test/std/localization/locale.categories/category.numeric/locale.nm.put/facet.num.put.members/put_long_double.pass.cpp
+++ b/libcxx/test/std/localization/locale.categories/category.numeric/locale.nm.put/facet.num.put.members/put_long_double.pass.cpp
@@ -22626,6 +22626,52 @@ void test10() {
   }
 }
 
+void test11() {
+  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();
@@ -22637,6 +22683,7 @@ int main(int, char**) {
   test8();
   test9();
   test10();
+  test11();
   std::locale lc = std::locale::classic();
   std::locale lg(lc, new my_numpunct);
   const my_facet f(1);

>From b1a3b8bf15d8d65248d0b426bb8c9e9671b98f6f Mon Sep 17 00:00:00 2001
From: c8ef <c8ef at outlook.com>
Date: Sat, 27 Jun 2026 16:08:17 +0800
Subject: [PATCH 3/3] fix long double

---
 .../facet.num.put.members/put_long_double.pass.cpp            | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libcxx/test/std/localization/locale.categories/category.numeric/locale.nm.put/facet.num.put.members/put_long_double.pass.cpp b/libcxx/test/std/localization/locale.categories/category.numeric/locale.nm.put/facet.num.put.members/put_long_double.pass.cpp
index f6479be54c192..6081407d69554 100644
--- a/libcxx/test/std/localization/locale.categories/category.numeric/locale.nm.put/facet.num.put.members/put_long_double.pass.cpp
+++ b/libcxx/test/std/localization/locale.categories/category.numeric/locale.nm.put/facet.num.put.members/put_long_double.pass.cpp
@@ -22632,7 +22632,7 @@ void test11() {
   const my_facet f(1);
 
   {
-    double v = INFINITY;
+    long double v = INFINITY;
     std::ios ios(0);
     std::fixed(ios);
     ios.imbue(lc);
@@ -22652,7 +22652,7 @@ void test11() {
   }
 
   {
-    double v = NAN;
+    long double v = NAN;
     std::ios ios(0);
     std::fixed(ios);
     ios.imbue(lc);



More information about the libcxx-commits mailing list