This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[v3] libstdc++/7222


Simple patch. This is quequed for the gcc-3_1-branch, and is non-invasive.

tested x86/linux

2002-07-24  Benjamin Kosnik  <bkoz@redhat.com>

	PR libstdc++/7222
	* src/locale.cc (locale::locale(const char*)): Use setlocale NULL.
	* testsuite/22_locale/members.cc (test03): Add test.


Index: src/locale.cc
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/src/locale.cc,v
retrieving revision 1.60
diff -c -p -r1.60 locale.cc
*** src/locale.cc	18 Apr 2002 23:47:48 -0000	1.60
--- src/locale.cc	25 Jul 2002 06:20:48 -0000
*************** namespace std 
*** 202,208 ****
  	if (strcmp(__s, "C") == 0 || strcmp(__s, "POSIX") == 0)
  	  (_M_impl = _S_classic)->_M_add_reference();
  	else if (strcmp(__s, "") == 0)
! 	  _M_impl = new _Impl(setlocale(LC_ALL, __s), 1);
  	else
  	  _M_impl = new _Impl(__s, 1);
        }
--- 202,208 ----
  	if (strcmp(__s, "C") == 0 || strcmp(__s, "POSIX") == 0)
  	  (_M_impl = _S_classic)->_M_add_reference();
  	else if (strcmp(__s, "") == 0)
! 	  _M_impl = new _Impl(setlocale(LC_ALL, NULL), 1);
  	else
  	  _M_impl = new _Impl(__s, 1);
        }
Index: testsuite/22_locale/ctor_copy_dtor.cc
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/testsuite/22_locale/ctor_copy_dtor.cc,v
retrieving revision 1.13
diff -c -p -r1.13 ctor_copy_dtor.cc
*** testsuite/22_locale/ctor_copy_dtor.cc	17 Jan 2002 22:29:44 -0000	1.13
--- testsuite/22_locale/ctor_copy_dtor.cc	25 Jul 2002 06:20:50 -0000
***************
*** 25,31 ****
  #include <stdexcept>
  #include <testsuite_hooks.h>
  
- 
  void test00()
  {
    // Should be able to do this as the first thing that happens in a
--- 25,30 ----
*************** void test01()
*** 238,250 ****
  }
  #endif // _GLIBCPP_USE___ENC_TRAITS
  
! int main ()
  {
    test00();
  
  #if _GLIBCPP_USE___ENC_TRAITS
    test01();
  #endif 
  
    return 0;
  }
--- 237,265 ----
  }
  #endif // _GLIBCPP_USE___ENC_TRAITS
  
! // libstdc++/7222
! void test02()
! {
!   bool test = true;
!   std::locale loc_c1("C");
!   std::locale loc_c2 ("C");
!   
!   std::locale loc_1("");
!   std::locale loc_2("");
! 
!   VERIFY( loc_c1 == loc_c2 );
!   VERIFY( loc_1 == loc_2 );
! }
! 
! int main()
  {
    test00();
  
  #if _GLIBCPP_USE___ENC_TRAITS
    test01();
  #endif 
+ 
+   test02();
  
    return 0;
  }


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]