Debian Codegraph @

libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_pod.pass.cpp

raw
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 // type_traits
10
11 // is_pod
12
13 // ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS
14
15 #include <type_traits>
16 #include "test_macros.h"
17
18 template <class T>
19 void test_is_pod()
20 {
21 static_assert( std::is_pod<T>::value, "");
22 static_assert( std::is_pod<const T>::value, "");
23 static_assert( std::is_pod<volatile T>::value, "");
24 static_assert( std::is_pod<const volatile T>::value, "");
25 #if TEST_STD_VER > 14
26 static_assert( std::is_pod_v<T>, "");
27 static_assert( std::is_pod_v<const T>, "");
28 static_assert( std::is_pod_v<volatile T>, "");
29 static_assert( std::is_pod_v<const volatile T>, "");
30 #endif
31 }
32
33 template <class T>
34 void test_is_not_pod()
35 {
36 static_assert(!std::is_pod<T>::value, "");
37 static_assert(!std::is_pod<const T>::value, "");
38 static_assert(!std::is_pod<volatile T>::value, "");
39 static_assert(!std::is_pod<const volatile T>::value, "");
40 #if TEST_STD_VER > 14
41 static_assert(!std::is_pod_v<T>, "");
42 static_assert(!std::is_pod_v<const T>, "");
43 static_assert(!std::is_pod_v<volatile T>, "");
44 static_assert(!std::is_pod_v<const volatile T>, "");
45 #endif
46 }
47
48 class Class
49 {
50 public:
51 ~Class();
52 };
53
54 int main(int, char**)
55 {
56 test_is_not_pod<void>();
57 test_is_not_pod<int&>();
58 test_is_not_pod<Class>();
59
60 test_is_pod<int>();
61 test_is_pod<double>();
62 test_is_pod<int*>();
63 test_is_pod<const int*>();
64 test_is_pod<char[3]>();
65 test_is_pod<char[]>();
66
67 return 0;
68 }