[mlir][Vector] Fix `vector.shuffle` folder for poison indices (#124863)
[llvm-project.git] / libcxx / test / std / language.support / support.dynamic / destroying_delete_t_declaration.pass.cpp
blob6835246c3bcc0cbde5a5dd66b039527c1d21d0a0
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 //===----------------------------------------------------------------------===//
9 // struct destroying_delete_t {
10 // explicit destroying_delete_t() = default;
11 // };
12 // inline constexpr destroying_delete_t destroying_delete{};
14 // UNSUPPORTED: c++03, c++11, c++14, c++17
16 // Test only the library parts of destroying delete in this test.
17 // Verify that it's properly declared after C++17 and that it's constexpr.
19 // Other tests will check the language side of things -- but those are
20 // limited to newer compilers.
22 #include <new>
24 #include <cassert>
25 #include <type_traits>
27 #include "test_macros.h"
28 #include "test_convertible.h"
30 #ifdef __cpp_impl_destroying_delete
31 # ifndef __cpp_lib_destroying_delete
32 # error "Expected __cpp_lib_destroying_delete to be defined"
33 # elif __cpp_lib_destroying_delete < 201806L
34 # error "Unexpected value of __cpp_lib_destroying_delete"
35 # endif
36 #else
37 # ifdef __cpp_lib_destroying_delete
38 # error "__cpp_lib_destroying_delete should not be defined unless the compiler supports it"
39 # endif
40 #endif
42 constexpr bool test_constexpr(std::destroying_delete_t) {
43 return true;
46 int main(int, char**) {
47 static_assert(std::is_default_constructible<std::destroying_delete_t>::value, "");
48 static_assert(!test_convertible<std::destroying_delete_t>(), "");
49 constexpr std::destroying_delete_t dd{};
50 static_assert(&dd != &std::destroying_delete, "");
51 static_assert(test_constexpr(std::destroying_delete), "");
52 return 0;