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