1 //===----------------------------------------------------------------------===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is dual licensed under the MIT and the University of Illinois Open
6 // Source Licenses. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 
10 // <locale>
11 
12 // template <> class ctype<char>
13 
14 // ~ctype();
15 
16 #include <locale>
17 #include <cassert>
18 
19 #include "count_new.hpp"
20 
main()21 int main()
22 {
23     {
24         std::locale l(std::locale::classic(), new std::ctype<char>);
25         assert(globalMemCounter.checkDeleteArrayCalledEq(0));
26     }
27     assert(globalMemCounter.checkDeleteArrayCalledEq(0));
28     {
29         std::ctype<char>::mask table[256];
30         std::locale l(std::locale::classic(), new std::ctype<char>(table));
31         assert(globalMemCounter.checkDeleteArrayCalledEq(0));
32     }
33     assert(globalMemCounter.checkDeleteArrayCalledEq(0));
34     {
35         std::locale l(std::locale::classic(),
36             new std::ctype<char>(new std::ctype<char>::mask[256], true));
37         assert(globalMemCounter.checkDeleteArrayCalledEq(0));
38     }
39     assert(globalMemCounter.checkDeleteArrayCalledEq(1));
40 }
41