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 // <codecvt> 10 11 // template <class Elem, unsigned long Maxcode = 0x10ffff, 12 // codecvt_mode Mode = (codecvt_mode)0> 13 // class codecvt_utf8_utf16 14 // : public codecvt<Elem, char, mbstate_t> 15 // { 16 // // unspecified 17 // }; 18 19 // result 20 // unshift(stateT& state, 21 // externT* to, externT* to_end, externT*& to_next) const; 22 23 #include <codecvt> 24 #include <cassert> 25 26 #include "test_macros.h" 27 28 int main(int, char**) 29 { 30 #ifndef TEST_HAS_NO_WIDE_CHARACTERS 31 { 32 typedef std::codecvt_utf8_utf16<wchar_t> C; 33 C c; 34 char n[4] = {0}; 35 std::mbstate_t m; 36 char* np = nullptr; 37 std::codecvt_base::result r = c.unshift(m, n, n+4, np); 38 assert(r == std::codecvt_base::noconv); 39 } 40 #endif 41 { 42 typedef std::codecvt_utf8_utf16<char16_t> C; 43 C c; 44 char n[4] = {0}; 45 std::mbstate_t m; 46 char* np = nullptr; 47 std::codecvt_base::result r = c.unshift(m, n, n+4, np); 48 assert(r == std::codecvt_base::noconv); 49 } 50 { 51 typedef std::codecvt_utf8_utf16<char32_t> C; 52 C c; 53 char n[4] = {0}; 54 std::mbstate_t m; 55 char* np = nullptr; 56 std::codecvt_base::result r = c.unshift(m, n, n+4, np); 57 assert(r == std::codecvt_base::noconv); 58 } 59 60 return 0; 61 } 62