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
14 //     : public codecvt<Elem, char, mbstate_t>
15 // {
16 //     // unspecified
17 // };
18 
19 // XFAIL: libcpp-has-no-wide-characters
20 
21 // Not a portable test
22 
23 #include <codecvt>
24 #include <cstdlib>
25 #include <cassert>
26 
27 #include "count_new.h"
28 
29 #include "test_macros.h"
30 
31 int main(int, char**)
32 {
33     globalMemCounter.reset();
34     assert(globalMemCounter.checkOutstandingNewEq(0));
35     {
36         typedef std::codecvt_utf8<wchar_t> C;
37         C c;
38         assert(globalMemCounter.checkOutstandingNewEq(0));
39     }
40     {
41         typedef std::codecvt_utf8<wchar_t> C;
42         std::locale loc(std::locale::classic(), new C);
43         assert(globalMemCounter.checkOutstandingNewNotEq(0));
44     }
45     assert(globalMemCounter.checkOutstandingNewEq(0));
46 
47   return 0;
48 }
49