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 // <memory> 10 11 // default_delete 12 13 // Test that default_delete<T[]> has a working default constructor 14 15 #include <memory> 16 #include <cassert> 17 18 #include "test_macros.h" 19 20 struct A 21 { 22 static int count; AA23 A() {++count;} AA24 A(const A&) {++count;} ~AA25 ~A() {--count;} 26 }; 27 28 int A::count = 0; 29 main(int,char **)30int main(int, char**) 31 { 32 std::default_delete<A[]> d; 33 A* p = new A[3]; 34 assert(A::count == 3); 35 d(p); 36 assert(A::count == 0); 37 38 return 0; 39 } 40