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 #include <memory> 14 #include <cassert> 15 16 #include "test_macros.h" 17 18 struct A 19 { 20 static int count; AA21 A() {++count;} AA22 A(const A&) {++count;} ~AA23 ~A() {--count;} 24 }; 25 26 int A::count = 0; 27 main(int,char **)28int main(int, char**) 29 { 30 std::default_delete<A> d; 31 A* p = new A; 32 assert(A::count == 1); 33 d(p); 34 assert(A::count == 0); 35 36 return 0; 37 } 38