1 //===----------------------------------------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 // <locale>
10 
11 // template <> class codecvt<char16_t, char8_t, mbstate_t>
12 
13 // result unshift(stateT& state,
14 //                externT* to, externT* to_end, externT*& to_next) const;
15 
16 // UNSUPPORTED: c++03, c++11, c++14, c++17
17 
18 // C++20 codecvt specializations for char8_t are not yet implemented:
19 // UNSUPPORTED: libc++
20 
21 #include <cassert>
22 #include <locale>
23 
main(int,char **)24 int main(int, char**) {
25   using F = std::codecvt<char16_t, char8_t, std::mbstate_t>;
26   const F& f = std::use_facet<F>(std::locale::classic());
27   std::mbstate_t mbs = {};
28   char8_t to[3];
29   char8_t* to_next = nullptr;
30   assert(f.unshift(mbs, to, to + 3, to_next) == F::noconv);
31   assert(to_next == to);
32   return 0;
33 }
34