[libcxx-commits] [libcxx] [libc++] Improves UB handling in ios_base destructor. (PR #76525)
Louis Dionne via libcxx-commits
libcxx-commits at lists.llvm.org
Tue Mar 5 10:02:16 PST 2024
================
@@ -360,7 +360,50 @@ public:
}
protected:
- _LIBCPP_HIDE_FROM_ABI ios_base() { // purposefully does no initialization
+ _LIBCPP_HIDE_FROM_ABI ios_base() : __loc_(nullptr) {
+ // purposefully does no initialization
+ //
+ // Except for the locale, this is a sentinel to avoid destroying
----------------
ldionne wrote:
I would move this useful but large explanation to the test, and I would only explain that we use `__loc_(nullptr)` as a sentinel to know whether we want to actually run the destructor or not.
https://github.com/llvm/llvm-project/pull/76525
More information about the libcxx-commits
mailing list