default.pass.cpp revision c52f43e72dfcea03037729649da84c23b3beb04a
1//===----------------------------------------------------------------------===//
2//
3//                     The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. 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
19struct A
20{
21    static int count;
22    A() {++count;}
23    A(const A&) {++count;}
24    ~A() {--count;}
25};
26
27int A::count = 0;
28
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