@@ -219,13 +219,19 @@ locale::__imp::__imp(size_t refs) : facet(refs), facets_(N), name_("C") {
219219}
220220
221221locale::__imp::__imp (const string& name, size_t refs) : facet(refs), facets_(N), name_(name) {
222+ std::fprintf (stderr, " Entering __imp(string const&) constructor\n " );
222223#if _LIBCPP_HAS_EXCEPTIONS
223224 try {
224225#endif // _LIBCPP_HAS_EXCEPTIONS
226+ std::fprintf (stderr, " Calling locale::classic()\n " );
225227 facets_ = locale::classic ().__locale_ ->facets_ ;
228+
229+ std::fprintf (stderr, " Calling __add_shared() on facets\n " );
226230 for (unsigned i = 0 ; i < facets_.size (); ++i)
227231 if (facets_[i])
228232 facets_[i]->__add_shared ();
233+
234+ std::fprintf (stderr, " Installing locales\n " );
229235 install (new collate_byname<char >(name_));
230236#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
231237 install (new collate_byname<wchar_t >(name_));
@@ -270,12 +276,15 @@ locale::__imp::__imp(const string& name, size_t refs) : facet(refs), facets_(N),
270276#endif
271277#if _LIBCPP_HAS_EXCEPTIONS
272278 } catch (...) {
279+ std::fprintf (stderr, " Releasing facets in catch block\n " );
273280 for (unsigned i = 0 ; i < facets_.size (); ++i)
274281 if (facets_[i])
275282 facets_[i]->__release_shared ();
276283 throw ;
277284 }
278285#endif // _LIBCPP_HAS_EXCEPTIONS
286+
287+ std::fprintf (stderr, " Done installing locales\n " );
279288}
280289
281290locale::__imp::__imp (const __imp& other) : facets_ (max<size_t >(N, other.facets_ .size ())), name_ (other.name_ ) {
@@ -533,8 +542,15 @@ const locale& locale::operator=(const locale& other) noexcept {
533542 return *this ;
534543}
535544
536- locale::locale (const char * name)
537- : __locale_ (name ? new __imp (name) : (__throw_runtime_error (" locale constructed with null" ), nullptr )) {
545+ locale::locale (const char * name) {
546+ std::fprintf (stderr, " Entering locale(char const*) constructor\n " );
547+ if (name == nullptr )
548+ std::__throw_runtime_error (" locale constructed with null" );
549+
550+ std::fprintf (stderr, " Running new __imp(name);\n " );
551+ __locale_ = new __imp (name);
552+
553+ std::fprintf (stderr, " Running locale_->acquire()\n " );
538554 __locale_->acquire ();
539555}
540556
0 commit comments