1 //===----------------------------------------------------------------------===//
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
7 //===----------------------------------------------------------------------===//
11 // ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS
13 // template <class Elem, unsigned long Maxcode = 0x10ffff,
14 // codecvt_mode Mode = (codecvt_mode)0>
15 // class codecvt_utf16
16 // : public codecvt<Elem, char, mbstate_t>
21 // int max_length() const throw();
26 #include "test_macros.h"
28 template <class CharT
, std::size_t = sizeof(CharT
)>
31 template <class CharT
>
32 struct TestHelper
<CharT
, 2> {
36 template <class CharT
>
37 struct TestHelper
<CharT
, 4> {
41 template <class CharT
>
42 void TestHelper
<CharT
, 2>::test() {
44 typedef std::codecvt_utf16
<CharT
> C
;
46 int r
= c
.max_length();
50 typedef std::codecvt_utf16
<CharT
, 0xFFFFFFFF, std::consume_header
> C
;
52 int r
= c
.max_length();
57 template <class CharT
>
58 void TestHelper
<CharT
, 4>::test() {
60 typedef std::codecvt_utf16
<CharT
> C
;
62 int r
= c
.max_length();
66 typedef std::codecvt_utf16
<CharT
, 0xFFFFFFFF, std::consume_header
> C
;
68 int r
= c
.max_length();
73 int main(int, char**) {
74 #ifndef TEST_HAS_NO_WIDE_CHARACTERS
75 TestHelper
<wchar_t>::test();
77 TestHelper
<char16_t
>::test();
78 TestHelper
<char32_t
>::test();