@@ -51,6 +51,14 @@ struct is_constructible {
5151template <typename ... Args>
5252constexpr bool is_constructible_v = __is_constructible(Args...);
5353
54+ template <typename T>
55+ struct is_aggregate {
56+ static constexpr bool value = __is_aggregate(T);
57+ };
58+
59+ template <typename T>
60+ constexpr bool is_aggregate_v = __is_aggregate(T);
61+
5462template <typename T>
5563struct is_final {
5664 static constexpr bool value = __is_final(T);
@@ -96,7 +104,7 @@ constexpr bool is_assignable_v = __is_assignable(T, U);
96104
97105template <typename T>
98106struct __details_is_empty {
99- static constexpr bool value = __is_empty(T);
107+ static constexpr bool value = __is_empty(T);
100108};
101109template <typename T>
102110using is_empty = __details_is_empty<T>;
@@ -105,9 +113,7 @@ constexpr bool is_empty_v = __is_empty(T);
105113
106114template <typename T>
107115struct __details_is_standard_layout {
108- static constexpr bool value = __is_standard_layout(T);
109-
110-
116+ static constexpr bool value = __is_standard_layout(T);
111117};
112118template <typename T>
113119using is_standard_layout = __details_is_standard_layout<T>;
@@ -125,6 +131,17 @@ using is_constructible = __details_is_constructible<Args...>;
125131template <typename ... Args>
126132constexpr bool is_constructible_v = __is_constructible(Args...);
127133
134+ template <typename T>
135+ struct __details_is_aggregate {
136+ static constexpr bool value = __is_aggregate(T);
137+ };
138+
139+ template <typename T>
140+ using is_aggregate = __details_is_aggregate<T>;
141+
142+ template <typename T>
143+ constexpr bool is_aggregate_v = __is_aggregate(T);
144+
128145template <typename T>
129146struct __details_is_final {
130147 static constexpr bool value = __is_final(T);
@@ -191,11 +208,20 @@ template <typename... Args>
191208struct __details_is_constructible : bool_constant<__is_constructible(Args...)> {};
192209
193210template <typename ... Args>
194- using is_constructible = __details_is_constructible<Args...>;
211+ using is_constructible = __details_is_constructible<Args...>;
195212
196213template <typename ... Args>
197214constexpr bool is_constructible_v = is_constructible<Args...>::value;
198215
216+ template <typename T>
217+ struct __details_is_aggregate : bool_constant<__is_aggregate(T)> {};
218+
219+ template <typename T>
220+ using is_aggregate = __details_is_aggregate<T>;
221+
222+ template <typename T>
223+ constexpr bool is_aggregate_v = is_aggregate<T>::value;
224+
199225template <typename T>
200226struct __details_is_final : bool_constant<__is_final(T)> {};
201227template <typename T>
@@ -204,7 +230,6 @@ template <typename T>
204230constexpr bool is_final_v = is_final<T>::value;
205231
206232#endif
207-
208233}
209234
210235static_assert (std::is_trivially_relocatable<int >::value);
@@ -299,6 +324,18 @@ static_assert(std::is_final_v<Arr>);
299324// expected-note@-1 {{'int[3]' is not final}} \
300325// expected-note@-1 {{because it is not a class or union type}}
301326
327+
328+ static_assert (!std::is_aggregate<int >::value);
329+
330+ static_assert (std::is_aggregate<void >::value);
331+ // expected-error-re@-1 {{static assertion failed due to requirement 'std::{{.*}}is_aggregate<void>::value'}} \
332+ // expected-note@-1 {{'void' is not aggregate}} \
333+ // expected-note@-1 {{because it is a cv void type}}
334+ static_assert (std::is_aggregate_v<void >);
335+ // expected-error@-1 {{static assertion failed due to requirement 'std::is_aggregate_v<void>'}} \
336+ // expected-note@-1 {{'void' is not aggregate}} \
337+ // expected-note@-1 {{because it is a cv void type}}
338+
302339namespace test_namespace {
303340 using namespace std ;
304341 static_assert (is_trivially_relocatable<int &>::value);
@@ -351,6 +388,15 @@ namespace test_namespace {
351388 static_assert (is_constructible_v<void >);
352389 // expected-error@-1 {{static assertion failed due to requirement 'is_constructible_v<void>'}} \
353390 // expected-note@-1 {{because it is a cv void type}}
391+
392+ static_assert (std::is_aggregate<void >::value);
393+ // expected-error-re@-1 {{static assertion failed due to requirement 'std::{{.*}}is_aggregate<void>::value'}} \
394+ // expected-note@-1 {{'void' is not aggregate}} \
395+ // expected-note@-1 {{because it is a cv void type}}
396+ static_assert (std::is_aggregate_v<void >);
397+ // expected-error@-1 {{static assertion failed due to requirement 'std::is_aggregate_v<void>'}} \
398+ // expected-note@-1 {{'void' is not aggregate}} \
399+ // expected-note@-1 {{because it is a cv void type}}
354400
355401 static_assert (is_final<int &>::value);
356402 // expected-error-re@-1 {{static assertion failed due to requirement '{{.*}}is_final<int &>::value'}} \
@@ -413,6 +459,14 @@ concept C3 = std::is_constructible_v<Args...>; // #concept6
413459template <C3 T> void g3 (); // #cand6
414460
415461
462+ template <typename T>
463+ requires std::is_aggregate<T>::value void f5 (); // #cand9
464+
465+ template <typename T>
466+ concept C5 = std::is_aggregate_v<T>; // #concept10
467+
468+ template <C5 T> void g5 (); // #cand10
469+
416470void test () {
417471 f<int &>();
418472 // expected-error@-1 {{no matching function for call to 'f'}} \
@@ -469,6 +523,21 @@ void test() {
469523 // expected-note@#cand6 {{because 'void' does not satisfy 'C3'}} \
470524 // expected-note@#concept6 {{because 'std::is_constructible_v<void>' evaluated to false}} \
471525 // expected-note@#concept6 {{because it is a cv void type}}
526+
527+ f5<void >();
528+ // expected-error@-1 {{no matching function for call to 'f5'}} \
529+ // expected-note@#cand9 {{candidate template ignored: constraints not satisfied [with T = void]}} \
530+ // expected-note-re@#cand9 {{because '{{.*}}is_aggregate<void>::value' evaluated to false}} \
531+ // expected-note@#cand9 {{'void' is not aggregate}} \
532+ // expected-note@#cand9 {{because it is a cv void type}}
533+
534+ g5<void >();
535+ // expected-error@-1 {{no matching function for call to 'g5'}} \
536+ // expected-note@#cand10 {{candidate template ignored: constraints not satisfied [with T = void]}} \
537+ // expected-note@#cand10 {{because 'void' does not satisfy 'C5'}} \
538+ // expected-note@#concept10 {{because 'std::is_aggregate_v<void>' evaluated to false}} \
539+ // expected-note@#concept10 {{'void' is not aggregate}} \
540+ // expected-note@#concept10 {{because it is a cv void type}}
472541}
473542}
474543
0 commit comments