| 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 |
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS -D_LIBCPP_ENABLE_CXX26_REMOVED_CODECVT |
| 12 |
|
| 13 |
// template <class Elem, unsigned long Maxcode = 0x10ffff, |
| 14 |
// codecvt_mode Mode = (codecvt_mode)0> |
| 15 |
// class codecvt_utf8_utf16 |
| 16 |
// : public codecvt<Elem, char, mbstate_t> |
| 17 |
// { |
| 18 |
// // unspecified |
| 19 |
// }; |
| 20 |
|
| 21 |
// int encoding() const throw(); |
| 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 |
int r = c.encoding(); |
| 35 |
assert(r == 0); |
| 36 |
} |
| 37 |
#endif |
| 38 |
{ |
| 39 |
typedef std::codecvt_utf8_utf16<char16_t> C; |
| 40 |
C c; |
| 41 |
int r = c.encoding(); |
| 42 |
assert(r == 0); |
| 43 |
} |
| 44 |
{ |
| 45 |
typedef std::codecvt_utf8_utf16<char32_t> C; |
| 46 |
C c; |
| 47 |
int r = c.encoding(); |
| 48 |
assert(r == 0); |
| 49 |
} |
| 50 |
|
| 51 |
return 0; |
| 52 |
} |