50714.cc 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. // { dg-require-namedlocale "de_DE.ISO8859-15" }
  2. // Copyright (C) 2011-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. #include <locale>
  17. #include <ext/pod_char_traits.h>
  18. #include <testsuite_hooks.h>
  19. #define mychar __gnu_cxx::character<unsigned short, int>
  20. namespace std
  21. {
  22. template<> codecvt<mychar, char, mbstate_t>::~codecvt()
  23. { }
  24. template<>
  25. codecvt<mychar, char, mbstate_t>::result
  26. codecvt<mychar, char, mbstate_t>::
  27. do_out(state_type&, const intern_type*, const intern_type*,
  28. const intern_type*&, extern_type*, extern_type*,
  29. extern_type*&) const
  30. { return codecvt_base::ok; }
  31. template<>
  32. codecvt<mychar, char, mbstate_t>::result
  33. codecvt<mychar, char, mbstate_t>::
  34. do_in(state_type&, const extern_type*, const extern_type*,
  35. const extern_type*&, intern_type*, intern_type*,
  36. intern_type*&) const
  37. { return codecvt_base::ok; }
  38. template<>
  39. codecvt<mychar, char, mbstate_t>::result
  40. codecvt<mychar, char, mbstate_t>::
  41. do_unshift(state_type&, extern_type*, extern_type*,
  42. extern_type*&) const
  43. { return noconv; }
  44. template<>
  45. int
  46. codecvt<mychar, char, mbstate_t>::do_encoding() const throw()
  47. { return 0; }
  48. template<>
  49. bool
  50. codecvt<mychar, char, mbstate_t>::do_always_noconv() const throw()
  51. { return false; }
  52. template<>
  53. int
  54. codecvt<mychar, char, mbstate_t>::
  55. do_length(state_type&, const extern_type*, const extern_type*,
  56. size_t) const
  57. { return 0; }
  58. template<>
  59. int
  60. codecvt<mychar, char, mbstate_t>::do_max_length() const throw()
  61. { return 4; }
  62. }
  63. // libstdc++/50714
  64. void test01()
  65. {
  66. using namespace std;
  67. {
  68. locale loc(locale::classic(),
  69. new codecvt<mychar, char, mbstate_t>());
  70. }
  71. {
  72. locale loc2(locale::classic(),
  73. new codecvt_byname<mychar, char, mbstate_t>(ISO_8859(15,de_DE)));
  74. }
  75. }
  76. int main()
  77. {
  78. test01();
  79. return 0;
  80. }