[PowerPC][NFC] Cleanup PPCCTRLoopsVerify pass
[llvm-project.git] / libcxx / test / std / language.support / support.dynamic / destroying_delete_t_declaration.pass.cpp
blobb98af1bfe1e45f73607a06a56b555da02277deb1
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 //===----------------------------------------------------------------------===//
10 // struct destroying_delete_t {
11 // explicit destroying_delete_t() = default;
12 // };
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.
23 #include <new>
25 #include <cassert>
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"
34 # endif
35 #else
36 # ifdef __cpp_lib_destroying_delete
37 # error "__cpp_lib_destroying_delete should not be defined unless the compiler supports it"
38 # endif
39 #endif
41 constexpr bool test_constexpr(std::destroying_delete_t) {
42 return true;
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), "");
51 return 0;