[libcxx-commits] [PATCH] D59572: Fix and speedup __libcpp_locale_guard on Windows

Tom Anderson via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Wed Mar 27 11:06:53 PDT 2019

thomasanderson marked an inline comment as done.
thomasanderson added inline comments.

Comment at: include/__locale:96
+      const char* __new_locale = setlocale(LC_ALL, __locale);
+      if (__new_locale == nullptr)
+        __throw_bad_alloc();
mclow.lists wrote:
> thomasanderson wrote:
> > mclow.lists wrote:
> > > I really doubt that this is going to work for anyone who builds with exceptions disabled.
> > > 
> > > On the other hand, maybe that's "not a thing" on windows and/or mingw.
> > Looks like `__throw_bad_alloc()` calls `std::abort()` if building without exceptions.  (Also there's similar unguarded calls to `__throw_bad_alloc()` in eg. `include/locale`)
> This is completely my bad. I was wrong here.
> I read this as `throw bad_alloc`, which will not work with exceptions disabled.
> `__throw_bad_alloc`, on the other hand, will work fine.
Ok cool, I'll land this as-is in that case



More information about the libcxx-commits mailing list