1 //===----------------------------------------------------------------------===//
3 // The LLVM Compiler Infrastructure
5 // This file is dual licensed under the MIT and the University of Illinois Open
6 // Source Licenses. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // struct destroying_delete_t {
11 // explicit destroying_delete_t() = default;
13 // inline constexpr destroying_delete_t destroying_delete{};
15 // UNSUPPORTED: c++03, c++11, c++14, c++17
17 // Test only the library parts of destroying delete in this test.
18 // Verify that it's properly declared after C++17 and that it's constexpr.
20 // Other tests will check the language side of things -- but those are
21 // limited to newer compilers.
26 #include "test_macros.h"
27 #include "test_convertible.h"
29 #ifdef __cpp_impl_destroying_delete
30 # ifndef __cpp_lib_destroying_delete
31 # error "Expected __cpp_lib_destroying_delete to be defined"
32 # elif __cpp_lib_destroying_delete < 201806L
33 # error "Unexpected value of __cpp_lib_destroying_delete"
36 # ifdef __cpp_lib_destroying_delete
37 # error "__cpp_lib_destroying_delete should not be defined unless the compiler supports it"
41 constexpr bool test_constexpr(std::destroying_delete_t
) {
45 int main(int, char**) {
46 static_assert(std::is_default_constructible
<std::destroying_delete_t
>::value
, "");
47 static_assert(!test_convertible
<std::destroying_delete_t
>(), "");
48 constexpr std::destroying_delete_t dd
{};
49 static_assert(&dd
!= &std::destroying_delete
, "");
50 static_assert(test_constexpr(std::destroying_delete
), "");