-2001-07-02 Loren J. Rittle <ljrittle@acm.org>
-
- libstdc++/3284
- * acinclude.m4 (GLIBCPP_ENABLE_THREADS): Portability enhancement.
- * aclocal.m4: Regenerate.
- * configure: Regenerate.
-
+2001-07-02 Benjamin Kosnik <bkoz@redhat.com>
+
+ * src/locale.cc (locale::locale(const char*)): Make sure global
+ locales are initialized.
+ * include/bits/locale_facets.tcc (locale::combine): Refcout should
+ be zero, not one as it's return-by-value.
+ * testsuite/27_io/ios_base_callbacks.cc (test01): Don't check for
+ named locales here.
+ * testsuite/22_locale/ctor_copy_dtor.cc (test01): Instead, check
+ for it here.
+ (test02): Add test.
+ * libsupc++/eh_alloc.cc: Use climits, not limits.h.
+
2001-07-02 Loren J. Rittle <ljrittle@acm.org>
libstdc++/3243
locale
locale::combine(const locale& __other)
{
- _Impl* __tmp = new _Impl(*_M_impl, 1);
+ _Impl* __tmp = new _Impl(*_M_impl, 0);
__tmp->_M_replace_facet(__other._M_impl, &_Facet::id);
return locale(__tmp);
}
#include <exception>
#include <cstdlib>
#include <cstring>
-#include <limits.h>
+#include <climits>
#include "unwind-cxx.h"
#include "bits/c++config.h"
#include "bits/gthr.h"
{
if (__s)
{
+ _S_initialize();
if (strcmp(__s, "C") == 0 || strcmp(__s, "POSIX") == 0)
(_M_impl = _S_classic)->_M_add_reference();
else
#include <stdexcept>
#include <debug_assert.h>
+
+void test00()
+{
+ // Should be able to do this as the first thing that happens in a
+ // file and have it not crash.
+ std::locale loc("C");
+}
+
#if _GLIBCPP_USE_WCHAR_T
typedef std::codecvt<char, char, std::mbstate_t> c_codecvt;
typedef std::codecvt_byname<char, char, std::mbstate_t> c_codecvt_byname;
catch(...)
{ VERIFY (false); }
+ try
+ { locale loc08("saturn_SUN*RA"); }
+ catch(runtime_error& obj)
+ { VERIFY (true); }
+ catch(...)
+ { VERIFY (false); }
+
// 4
// locale(const locale& other, const char* std_name, category)
{
int main ()
{
+ test00();
+
#if _GLIBCPP_USE_WCHAR_T
test01();
#endif
bool test01()
{
bool test = true;
- std::locale locco("saturn_SUN*RA");
+ std::locale loc("C");
std::stringbuf strbuf01;
std::ios ios01(&strbuf01);
ios01.register_callback(callb03, 1);
ios01.register_callback(callb02, 1);
ios01.register_callback(callb01, 1);
- ios01.imbue(locco);
+ ios01.imbue(loc);
VERIFY( str01 == str02 );
#ifdef DEBUG_ASSERT
return 0;
}
+