File: derived_from_integral_constant.compile.pass.cpp

package info (click to toggle)
llvm-toolchain-20 1%3A20.1.6-1~exp1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 2,111,304 kB
  • sloc: cpp: 7,438,677; ansic: 1,393,822; asm: 1,012,926; python: 241,650; f90: 86,635; objc: 75,479; lisp: 42,144; pascal: 17,286; sh: 10,027; ml: 5,082; perl: 4,730; awk: 3,523; makefile: 3,349; javascript: 2,251; xml: 892; fortran: 672
file content (116 lines) | stat: -rw-r--r-- 8,273 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
//===----------------------------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

// UNSUPPORTED: c++03

// Check that type traits derive from integral_constant

// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS

#include <cstddef>
#include <type_traits>

#include "test_macros.h"

static_assert(std::is_base_of<std::false_type, std::is_void<int>>::value, "");
static_assert(std::is_base_of<std::true_type, std::is_integral<int>>::value, "");
static_assert(std::is_base_of<std::false_type, std::is_floating_point<int>>::value, "");
static_assert(std::is_base_of<std::false_type, std::is_array<int>>::value, "");
static_assert(std::is_base_of<std::false_type, std::is_enum<int>>::value, "");
static_assert(std::is_base_of<std::false_type, std::is_union<int>>::value, "");
static_assert(std::is_base_of<std::false_type, std::is_class<int>>::value, "");
static_assert(std::is_base_of<std::false_type, std::is_function<int>>::value, "");
static_assert(std::is_base_of<std::false_type, std::is_pointer<int>>::value, "");
static_assert(std::is_base_of<std::false_type, std::is_lvalue_reference<int>>::value, "");
static_assert(std::is_base_of<std::false_type, std::is_rvalue_reference<int>>::value, "");
static_assert(std::is_base_of<std::false_type, std::is_member_object_pointer<int>>::value, "");
static_assert(std::is_base_of<std::false_type, std::is_member_function_pointer<int>>::value, "");
static_assert(std::is_base_of<std::true_type, std::is_fundamental<int>>::value, "");
static_assert(std::is_base_of<std::true_type, std::is_arithmetic<int>>::value, "");
static_assert(std::is_base_of<std::true_type, std::is_scalar<int>>::value, "");
static_assert(std::is_base_of<std::false_type, std::is_object<int&>>::value, "");
static_assert(std::is_base_of<std::false_type, std::is_compound<int>>::value, "");
static_assert(std::is_base_of<std::false_type, std::is_reference<int>>::value, "");
static_assert(std::is_base_of<std::false_type, std::is_member_pointer<int>>::value, "");
static_assert(std::is_base_of<std::false_type, std::is_const<int>>::value, "");
static_assert(std::is_base_of<std::false_type, std::is_volatile<int>>::value, "");
static_assert(std::is_base_of<std::true_type, std::is_trivial<int>>::value, "");
static_assert(std::is_base_of<std::true_type, std::is_trivially_copyable<int>>::value, "");
static_assert(std::is_base_of<std::true_type, std::is_standard_layout<int>>::value, "");
static_assert(std::is_base_of<std::true_type, std::is_pod<int>>::value, "");
static_assert(std::is_base_of<std::false_type, std::is_empty<int>>::value, "");
static_assert(std::is_base_of<std::false_type, std::is_polymorphic<int>>::value, "");
static_assert(std::is_base_of<std::false_type, std::is_abstract<int>>::value, "");
static_assert(std::is_base_of<std::true_type, std::is_signed<int>>::value, "");
static_assert(std::is_base_of<std::false_type, std::is_unsigned<int>>::value, "");
static_assert(std::is_base_of<std::true_type, std::is_constructible<int>>::value, "");
static_assert(std::is_base_of<std::true_type, std::is_trivially_constructible<int>>::value, "");
static_assert(std::is_base_of<std::true_type, std::is_nothrow_constructible<int>>::value, "");
static_assert(std::is_base_of<std::true_type, std::is_default_constructible<int>>::value, "");
static_assert(std::is_base_of<std::true_type, std::is_trivially_default_constructible<int>>::value, "");
static_assert(std::is_base_of<std::true_type, std::is_nothrow_default_constructible<int>>::value, "");
static_assert(std::is_base_of<std::true_type, std::is_copy_constructible<int>>::value, "");
static_assert(std::is_base_of<std::true_type, std::is_trivially_copy_constructible<int>>::value, "");
static_assert(std::is_base_of<std::true_type, std::is_nothrow_copy_constructible<int>>::value, "");
static_assert(std::is_base_of<std::true_type, std::is_move_constructible<int>>::value, "");
static_assert(std::is_base_of<std::true_type, std::is_trivially_move_constructible<int>>::value, "");
static_assert(std::is_base_of<std::true_type, std::is_nothrow_move_constructible<int>>::value, "");
static_assert(std::is_base_of<std::false_type, std::is_assignable<int, int>>::value, "");
static_assert(std::is_base_of<std::false_type, std::is_trivially_assignable<int, int>>::value, "");
static_assert(std::is_base_of<std::false_type, std::is_nothrow_assignable<int, int>>::value, "");
static_assert(std::is_base_of<std::true_type, std::is_copy_assignable<int>>::value, "");
static_assert(std::is_base_of<std::true_type, std::is_trivially_copy_assignable<int>>::value, "");
static_assert(std::is_base_of<std::true_type, std::is_nothrow_copy_assignable<int>>::value, "");
static_assert(std::is_base_of<std::true_type, std::is_move_assignable<int>>::value, "");
static_assert(std::is_base_of<std::true_type, std::is_trivially_move_assignable<int>>::value, "");
static_assert(std::is_base_of<std::true_type, std::is_nothrow_move_assignable<int>>::value, "");
static_assert(std::is_base_of<std::true_type, std::is_destructible<int>>::value, "");
static_assert(std::is_base_of<std::true_type, std::is_trivially_destructible<int>>::value, "");
static_assert(std::is_base_of<std::true_type, std::is_nothrow_destructible<int>>::value, "");
static_assert(std::is_base_of<std::false_type, std::has_virtual_destructor<int>>::value, "");
static_assert(std::is_base_of<std::integral_constant<std::size_t, 1>, std::alignment_of<char>>::value, "");
static_assert(std::is_base_of<std::integral_constant<std::size_t, 0>, std::rank<char>>::value, "");
static_assert(std::is_base_of<std::integral_constant<std::size_t, 0>, std::extent<char>>::value, "");
static_assert(std::is_base_of<std::true_type, std::is_same<int, int>>::value, "");
static_assert(std::is_base_of<std::false_type, std::is_base_of<int, int>>::value, "");
static_assert(std::is_base_of<std::true_type, std::is_convertible<int, int>>::value, "");
#if TEST_STD_VER <= 17
static_assert(std::is_base_of<std::true_type, std::is_literal_type<int>>::value, "");
#endif
#if TEST_STD_VER >= 14
static_assert(std::is_base_of<std::false_type, std::is_null_pointer<int>>::value, "");
static_assert(std::is_base_of<std::false_type, std::is_final<int>>::value, "");
#endif
#if TEST_STD_VER >= 17
static_assert(std::is_base_of<std::true_type, std::has_unique_object_representations<int>>::value, "");
static_assert(std::is_base_of<std::false_type, std::is_aggregate<int>>::value, "");
static_assert(std::is_base_of<std::false_type, std::is_swappable_with<int, int>>::value, "");
static_assert(std::is_base_of<std::true_type, std::is_swappable<int>>::value, "");
static_assert(std::is_base_of<std::false_type, std::is_nothrow_swappable_with<int, int>>::value, "");
static_assert(std::is_base_of<std::true_type, std::is_nothrow_swappable<int>>::value, "");
static_assert(std::is_base_of<std::false_type, std::is_invocable<int>>::value, "");
static_assert(std::is_base_of<std::false_type, std::is_invocable_r<int, int>>::value, "");
static_assert(std::is_base_of<std::false_type, std::is_nothrow_invocable<int, int>>::value, "");
static_assert(std::is_base_of<std::false_type, std::is_nothrow_invocable_r<int, int>>::value, "");
#endif
#if TEST_STD_VER >= 20
static_assert(std::is_base_of<std::false_type, std::is_bounded_array<int>>::value, "");
static_assert(std::is_base_of<std::false_type, std::is_unbounded_array<int>>::value, "");
static_assert(std::is_base_of<std::true_type, std::is_nothrow_convertible<int, int>>::value, "");
#endif
#if TEST_STD_VER >= 23
#  if defined(__cpp_lib_is_implicit_lifetime) && __cpp_lib_is_implicit_lifetime >= 202302L
static_assert(std::is_base_of<std::true_type, std::is_implicit_lifetime<int>>::value, "");
#  endif
static_assert(std::is_base_of<std::false_type, std::is_scoped_enum<int>>::value, "");
#endif
#if TEST_STD_VER >= 26
#  if defined(__cpp_lib_is_virtual_base_of) && __cpp_lib_is_virtual_base_of >= 202406L
static_assert(std::is_base_of<std::false_type, std::is_virtual_base_of<int, int>>::value, "");
#  endif
#endif