[libcxx-commits] [libcxx] [libc++][windows] Use _wsetlocale() in __locale_guard (PR #160479)

via libcxx-commits libcxx-commits at lists.llvm.org
Thu Nov 27 02:27:08 PST 2025


lb90 wrote:

Sorry for the delay! 🙏 

I have now added a link to the related MS STL PR! Yes, there were some concerns about ABI stability because I changed a non-POD type (templated class) from `char` to `wchar_t`. This made a deep copy of the string, and as such the char version wouldn't work. Anyway the ABI stability issue has been solved and the PR is now awaiting a final review.

>From what I can tell, this PR doesn't introduce any ABI change.

Well, actually, there's the problem of ODR violations because we're changing the body of methods defined within a class definition:

```c++
class Class
{
  void Method()
  {
    // ...
  }
};
```

Such methods are always `inline` (unless one includes Class via an unnamed namespace). Technically, those methods should never be changed. The problem is:

1. One compiles a static library using LibC++ version A
2. Later, a project is compiled with an upgraded LibC++ (version B) and links against the static library.

This introduces ODR violations. Anyway I don't think this is something we can control.

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


More information about the libcxx-commits mailing list