]>
Commit | Line | Data |
---|---|---|
40e2decb | 1 | // { dg-options "-std=gnu++17" } |
2 | // { dg-do compile { target c++17 } } | |
0b71441b | 3 | |
fbd26352 | 4 | // Copyright (C) 2017-2019 Free Software Foundation, Inc. |
0b71441b | 5 | // |
6 | // This file is part of the GNU ISO C++ Library. This library is free | |
7 | // software; you can redistribute it and/or modify it under the | |
8 | // terms of the GNU General Public License as published by the | |
9 | // Free Software Foundation; either version 3, or (at your option) | |
10 | // any later version. | |
11 | // | |
12 | // This library is distributed in the hope that it will be useful, | |
13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
15 | // GNU General Public License for more details. | |
16 | // | |
17 | // You should have received a copy of the GNU General Public License along | |
18 | // with this library; see the file COPYING3. If not see | |
19 | // <http://www.gnu.org/licenses/>. | |
20 | ||
21 | #include <type_traits> | |
22 | #include <testsuite_tr1.h> | |
23 | #include <tuple> | |
24 | ||
25 | template <class... T> void pos() | |
26 | { | |
27 | static_assert((std::is_aggregate_v<T> &&...)); | |
28 | } | |
29 | ||
30 | template <class... T> void neg() | |
31 | { | |
32 | static_assert((!std::is_aggregate_v<T> &&...)); | |
33 | } | |
34 | ||
35 | void test01() | |
36 | { | |
37 | using namespace __gnu_test; | |
38 | using __gnu_test::test_category; | |
39 | using std::is_aggregate; | |
40 | ||
41 | // Positive tests. | |
42 | static_assert(test_category<is_aggregate, | |
43 | ClassType>(true), ""); | |
44 | static_assert(test_category<is_aggregate, | |
45 | UnionType>(true), ""); | |
46 | static_assert(test_category<is_aggregate, | |
47 | SLType>(true), ""); | |
48 | static_assert(test_category<is_aggregate, | |
49 | NoexceptMoveAssignClass>(true), ""); | |
50 | static_assert(test_category<is_aggregate, | |
51 | unsigned[3]>(true), ""); | |
52 | static_assert(test_category<is_aggregate, | |
53 | unsigned[3][2]>(true), ""); | |
54 | static_assert(test_category<is_aggregate, | |
55 | unsigned[]>(true), ""); | |
56 | static_assert(test_category<is_aggregate, | |
57 | unsigned[][2]>(true), ""); | |
58 | static_assert(test_category<is_aggregate, | |
59 | EnumType[3]>(true), ""); | |
60 | static_assert(test_category<is_aggregate, | |
61 | EnumType[3][2]>(true), ""); | |
62 | static_assert(test_category<is_aggregate, | |
63 | EnumType[]>(true), ""); | |
64 | static_assert(test_category<is_aggregate, | |
65 | EnumType[][2]>(true), ""); | |
66 | pos<ClassType, UnionType, SLType, NoexceptMoveAssignClass, | |
67 | unsigned[3], unsigned[3][2], unsigned[], unsigned[][3]>(); | |
68 | ||
69 | // Negative tests. | |
70 | static_assert(test_category<is_aggregate, | |
71 | AbstractClass>(false), ""); | |
72 | static_assert(test_category<is_aggregate, | |
73 | PolymorphicClass>(false), ""); | |
74 | static_assert(test_category<is_aggregate, | |
75 | ExplicitClass>(false), ""); | |
76 | static_assert(test_category<is_aggregate, | |
77 | char>(false), ""); | |
78 | static_assert(test_category<is_aggregate, | |
79 | unsigned char>(false), ""); | |
80 | static_assert(test_category<is_aggregate, | |
81 | signed char>(false), ""); | |
82 | static_assert(test_category<is_aggregate, | |
83 | unsigned>(false), ""); | |
84 | static_assert(test_category<is_aggregate, | |
85 | bool>(false), ""); | |
86 | static_assert(test_category<is_aggregate, | |
87 | float>(false), ""); | |
88 | static_assert(test_category<is_aggregate, | |
89 | double>(false), ""); | |
90 | static_assert(test_category<is_aggregate, | |
91 | EnumType>(false), ""); | |
92 | static_assert(test_category<is_aggregate, | |
93 | void>(false), ""); | |
94 | neg<AbstractClass, PolymorphicClass, ExplicitClass, char, unsigned, | |
95 | bool, float, double, void>(); | |
96 | } |