12561885fSEric Fiselier //===----------------------------------------------------------------------===//
22561885fSEric Fiselier //
357b08b09SChandler Carruth // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
457b08b09SChandler Carruth // See https://llvm.org/LICENSE.txt for license information.
557b08b09SChandler Carruth // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
62561885fSEric Fiselier //
72561885fSEric Fiselier //===----------------------------------------------------------------------===//
82561885fSEric Fiselier 
92561885fSEric Fiselier // <memory>
102561885fSEric Fiselier 
112561885fSEric Fiselier // default_delete
122561885fSEric Fiselier 
132561885fSEric Fiselier #include <memory>
142561885fSEric Fiselier #include <cassert>
152561885fSEric Fiselier 
16*7fc6a556SMarshall Clow #include "test_macros.h"
17*7fc6a556SMarshall Clow 
182561885fSEric Fiselier struct A
192561885fSEric Fiselier {
202561885fSEric Fiselier     static int count;
AA212561885fSEric Fiselier     A() {++count;}
AA222561885fSEric Fiselier     A(const A&) {++count;}
~AA232561885fSEric Fiselier     ~A() {--count;}
242561885fSEric Fiselier };
252561885fSEric Fiselier 
262561885fSEric Fiselier int A::count = 0;
272561885fSEric Fiselier 
main(int,char **)282df59c50SJF Bastien int main(int, char**)
292561885fSEric Fiselier {
302561885fSEric Fiselier     std::default_delete<A> d;
312561885fSEric Fiselier     A* p = new A;
322561885fSEric Fiselier     assert(A::count == 1);
332561885fSEric Fiselier     d(p);
342561885fSEric Fiselier     assert(A::count == 0);
352df59c50SJF Bastien 
362df59c50SJF Bastien   return 0;
372561885fSEric Fiselier }
38