c++: Fix ICE with #embed/RAW_DATA_CST after list conversion [PR118671]
[gcc.git] / libstdc++-v3 / testsuite / 22_locale / codecvt / codecvt_unicode_char8_t.cc
blobd06fc57559db496e4ee74578e6b1549817f6f1b6
1 // Copyright (C) 2020-2025 Free Software Foundation, Inc.
2 //
3 // This file is part of the GNU ISO C++ Library. This library is free
4 // software; you can redistribute it and/or modify it under the
5 // terms of the GNU General Public License as published by the
6 // Free Software Foundation; either version 3, or (at your option)
7 // 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.
14 // You should have received a copy of the GNU General Public License along
15 // with this library; see the file COPYING3. If not see
16 // <http://www.gnu.org/licenses/>.
18 // { dg-do run { target c++11 } }
19 // { dg-require-cstdint "" }
20 // { dg-options "-fchar8_t" }
22 #include "codecvt_unicode.h"
24 using namespace std;
26 void
27 test_utf8_utf32_codecvts ()
29 using codecvt_c32_c8 = codecvt<char32_t, char8_t, mbstate_t>;
30 auto &loc_c = locale::classic ();
31 VERIFY (has_facet<codecvt_c32_c8> (loc_c));
33 auto &cvt = use_facet<codecvt_c32_c8> (loc_c);
34 test_utf8_utf32_cvt (cvt);
37 void
38 test_utf8_utf16_codecvts ()
40 using codecvt_c16_c8 = codecvt<char16_t, char8_t, mbstate_t>;
41 auto &loc_c = locale::classic ();
42 VERIFY (has_facet<codecvt_c16_c8> (loc_c));
44 auto &cvt = use_facet<codecvt_c16_c8> (loc_c);
45 test_utf8_utf16_cvt (cvt);
48 int
49 main ()
51 test_utf8_utf32_codecvts ();
52 test_utf8_utf16_codecvts ();