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 // convert constructor 14 15 #include <memory> 16 #include <cassert> 17 18 #include "test_macros.h" 19 #include "unique_ptr_test_helper.h" 20 test()21TEST_CONSTEXPR_CXX23 bool test() { 22 std::default_delete<B> d2; 23 std::default_delete<A> d1 = d2; 24 A* p = new B; 25 if (!TEST_IS_CONSTANT_EVALUATED) { 26 assert(A::count == 1); 27 assert(B::count == 1); 28 } 29 30 d1(p); 31 32 if (!TEST_IS_CONSTANT_EVALUATED) { 33 assert(A::count == 0); 34 assert(B::count == 0); 35 } 36 37 return true; 38 } 39 main(int,char **)40int main(int, char**) { 41 test(); 42 #if TEST_STD_VER >= 23 43 static_assert(test()); 44 #endif 45 46 return 0; 47 } 48