40184.cc 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. // { dg-require-namedlocale "ja_JP.eucJP" }
  2. // Copyright (C) 2009-2022 Free Software Foundation, Inc.
  3. //
  4. // This file is part of the GNU ISO C++ Library. This library is free
  5. // software; you can redistribute it and/or modify it under the
  6. // terms of the GNU General Public License as published by the
  7. // Free Software Foundation; either version 3, or (at your option)
  8. // any later version.
  9. // This library is distributed in the hope that it will be useful,
  10. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. // GNU General Public License for more details.
  13. // You should have received a copy of the GNU General Public License along
  14. // with this library; see the file COPYING3. If not see
  15. // <http://www.gnu.org/licenses/>.
  16. // 22.1.1.2 locale constructors and destructors [lib.locale.cons]
  17. #include <locale>
  18. #include <testsuite_hooks.h>
  19. // libstdc++/40184
  20. void test01()
  21. {
  22. #ifdef _GLIBCXX_USE_WCHAR_T
  23. using namespace std;
  24. locale locf(locale("C"), "ja_JP.eucJP", locale::monetary);
  25. const moneypunct<wchar_t, false>& mpf =
  26. use_facet<moneypunct<wchar_t, false> >(locf);
  27. locale locf_copy(locf.name().c_str());
  28. const moneypunct<wchar_t, false>& mpf_copy =
  29. use_facet<moneypunct<wchar_t, false> >(locf_copy);
  30. VERIFY( mpf.curr_symbol() == mpf_copy.curr_symbol() );
  31. locale loct(locale("C"), "ja_JP.eucJP", locale::monetary);
  32. const moneypunct<wchar_t, true>& mpt =
  33. use_facet<moneypunct<wchar_t, true> >(loct);
  34. locale loct_copy(loct.name().c_str());
  35. const moneypunct<wchar_t, true>& mpt_copy =
  36. use_facet<moneypunct<wchar_t, true> >(loct_copy);
  37. VERIFY( mpt.curr_symbol() == mpt_copy.curr_symbol() );
  38. #endif
  39. }
  40. int main()
  41. {
  42. test01();
  43. return 0;
  44. }