1 //===----------------------------------------------------------------------===//
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
7 //===----------------------------------------------------------------------===//
13 #include <type_traits>
14 #include "test_macros.h"
19 #if TEST_STD_VER >= 11
20 enum class Enum2
: int {};
28 static_assert(!std::is_void
<T
>::value
, "");
30 static_assert(!std::is_null_pointer
<T
>::value
, "");
32 static_assert(!std::is_integral
<T
>::value
, "");
33 static_assert(!std::is_floating_point
<T
>::value
, "");
34 static_assert(!std::is_array
<T
>::value
, "");
35 static_assert(!std::is_pointer
<T
>::value
, "");
36 static_assert(!std::is_lvalue_reference
<T
>::value
, "");
37 static_assert(!std::is_rvalue_reference
<T
>::value
, "");
38 static_assert(!std::is_member_object_pointer
<T
>::value
, "");
39 static_assert(!std::is_member_function_pointer
<T
>::value
, "");
40 static_assert(!std::is_enum
<T
>::value
, "");
41 static_assert(!std::is_union
<T
>::value
, "");
42 static_assert(!std::is_class
<T
>::value
, "");
43 static_assert( std::is_function
<T
>::value
, "");
46 // Since we can't actually add the const volatile and ref qualifiers once
47 // later let's use a macro to do it.
48 #define TEST_REGULAR(...) \
49 test<__VA_ARGS__>(); \
50 test<__VA_ARGS__ const>(); \
51 test<__VA_ARGS__ volatile>(); \
52 test<__VA_ARGS__ const volatile>()
55 #define TEST_REF_QUALIFIED(...) \
56 test<__VA_ARGS__ &>(); \
57 test<__VA_ARGS__ const &>(); \
58 test<__VA_ARGS__ volatile &>(); \
59 test<__VA_ARGS__ const volatile &>(); \
60 test<__VA_ARGS__ &&>(); \
61 test<__VA_ARGS__ const &&>(); \
62 test<__VA_ARGS__ volatile &&>(); \
63 test<__VA_ARGS__ const volatile &&>()
65 struct incomplete_type
;
69 TEST_REGULAR( void () );
70 TEST_REGULAR( void (int) );
71 TEST_REGULAR( int (double) );
72 TEST_REGULAR( int (double, char) );
73 TEST_REGULAR( void (...) );
74 TEST_REGULAR( void (int, ...) );
75 TEST_REGULAR( int (double, ...) );
76 TEST_REGULAR( int (double, char, ...) );
77 #if TEST_STD_VER >= 11
78 TEST_REF_QUALIFIED( void () );
79 TEST_REF_QUALIFIED( void (int) );
80 TEST_REF_QUALIFIED( int (double) );
81 TEST_REF_QUALIFIED( int (double, char) );
82 TEST_REF_QUALIFIED( void (...) );
83 TEST_REF_QUALIFIED( void (int, ...) );
84 TEST_REF_QUALIFIED( int (double, ...) );
85 TEST_REF_QUALIFIED( int (double, char, ...) );
89 static_assert(!std::is_function
<incomplete_type
>::value
, "");