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 //===----------------------------------------------------------------------===//
9 // UNSUPPORTED: c++03, c++11, c++14
13 // template <class T> struct is_aggregate;
14 // template <class T> constexpr bool is_aggregate_v = is_aggregate<T>::value;
16 #include <type_traits>
17 #include "test_macros.h"
22 static_assert( std::is_aggregate
<T
>::value
, "");
23 static_assert( std::is_aggregate
<const T
>::value
, "");
24 static_assert( std::is_aggregate
<volatile T
>::value
, "");
25 static_assert( std::is_aggregate
<const volatile T
>::value
, "");
26 static_assert( std::is_aggregate_v
<T
>, "");
27 static_assert( std::is_aggregate_v
<const T
>, "");
28 static_assert( std::is_aggregate_v
<volatile T
>, "");
29 static_assert( std::is_aggregate_v
<const volatile T
>, "");
35 static_assert(!std::is_aggregate
<T
>::value
, "");
36 static_assert(!std::is_aggregate
<const T
>::value
, "");
37 static_assert(!std::is_aggregate
<volatile T
>::value
, "");
38 static_assert(!std::is_aggregate
<const volatile T
>::value
, "");
39 static_assert(!std::is_aggregate_v
<T
>, "");
40 static_assert(!std::is_aggregate_v
<const T
>, "");
41 static_assert(!std::is_aggregate_v
<volatile T
>, "");
42 static_assert(!std::is_aggregate_v
<const volatile T
>, "");
46 struct HasCons
{ HasCons(int); };
48 void PreventUnusedPrivateMemberWarning();
52 struct Union
{ int x
; void* y
; };
62 test_false
<void() const>();
63 test_false
<void(Aggregate::*)(int) const>();
64 test_false
<Aggregate
&>();
65 test_false
<HasCons
>();
66 test_false
<HasPriv
>();
69 test_true
<Aggregate
>();
70 test_true
<Aggregate
[]>();
71 test_true
<Aggregate
[42][101]>();