[libcxx-commits] [libcxx] [libc++] Avoid type-punning locale in ios_base (PR #193507)

via libcxx-commits libcxx-commits at lists.llvm.org
Thu Apr 23 02:24:11 PDT 2026


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff origin/main HEAD --extensions ,cpp -- libcxx/include/__locale libcxx/include/ios libcxx/src/ios.cpp --diff_from_common_commit
``````````

:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/libcxx/include/ios b/libcxx/include/ios
index 9b5d6837a..9c03f56a2 100644
--- a/libcxx/include/ios
+++ b/libcxx/include/ios
@@ -392,15 +392,15 @@ private:
   iostate __rdstate_;
   iostate __exceptions_;
   void* __rdbuf_;
-#ifndef _LIBCPP_CXX03_LANG
+#    ifndef _LIBCPP_CXX03_LANG
   union {
     locale __loc_;
   };
-#else
+#    else
   // We only care about the union above to implement the destructor correctly, which we do in C++26 anyways. No need to
   // handle C++03 shenanigans.
   locale __loc_;
-#endif
+#    endif
   event_callback* __fn_;
   int* __index_;
   size_t __event_size_;

``````````

</details>


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


More information about the libcxx-commits mailing list