]>
git.ipfire.org Git - thirdparty/gcc.git/blob - libstdc++-v3/testsuite/20_util/is_aggregate/value.cc
1 // { dg-options "-std=gnu++17" }
2 // { dg-do compile { target c++17 } }
4 // Copyright (C) 2017-2019 Free Software Foundation, Inc.
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)
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.
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/>.
21 #include <type_traits>
22 #include <testsuite_tr1.h>
25 template <class... T
> void pos()
27 static_assert((std::is_aggregate_v
<T
> &&...));
30 template <class... T
> void neg()
32 static_assert((!std::is_aggregate_v
<T
> &&...));
37 using namespace __gnu_test
;
38 using __gnu_test::test_category
;
39 using std::is_aggregate
;
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
,
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]>();
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
,
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
,
86 static_assert(test_category
<is_aggregate
,
88 static_assert(test_category
<is_aggregate
,
90 static_assert(test_category
<is_aggregate
,
91 EnumType
>(false), "");
92 static_assert(test_category
<is_aggregate
,
94 neg
<AbstractClass
, PolymorphicClass
, ExplicitClass
, char, unsigned,
95 bool, float, double, void>();