| 1 |
// PR c++/100474 |
| 2 |
// { dg-do compile { target c++20 } } |
| 3 |
|
| 4 |
struct S { S() = delete; S(const S&); }; |
| 5 |
|
| 6 |
template<class T> |
| 7 |
concept Aggregate = __is_aggregate(T); |
| 8 |
// { dg-message "'S' is not an aggregate" "" { target *-*-* } .-1 } |
| 9 |
|
| 10 |
template<class T> |
| 11 |
concept TriviallyCopyable = __is_trivially_copyable(T); |
| 12 |
// { dg-message "'S' is not trivially copyable" "" { target *-*-* } .-1 } |
| 13 |
|
| 14 |
template<class T, class U> |
| 15 |
concept Assignable = __is_assignable(T, U); |
| 16 |
// { dg-message "'S' is not assignable from 'int'" "" { target *-*-* } .-1 } |
| 17 |
|
| 18 |
template<class T, class U> |
| 19 |
concept TriviallyAssignable = __is_trivially_assignable(T, U); |
| 20 |
// { dg-message "'S' is not trivially assignable from 'int'" "" { target *-*-* } .-1 } |
| 21 |
|
| 22 |
template<class T, class U> |
| 23 |
concept NothrowAssignable = __is_nothrow_assignable(T, U); |
| 24 |
// { dg-message "'S' is not nothrow assignable from 'int'" "" { target *-*-* } .-1 } |
| 25 |
|
| 26 |
template<class T, class... Args> |
| 27 |
concept Constructible = __is_constructible(T, Args...); |
| 28 |
// { dg-message "'S' is not default constructible" "" { target *-*-* } .-1 } |
| 29 |
// { dg-message "'S' is not constructible from 'int'" "" { target *-*-* } .-2 } |
| 30 |
// { dg-message "'S' is not constructible from 'int, char'" "" { target *-*-* } .-3 } |
| 31 |
|
| 32 |
template<class T, class... Args> |
| 33 |
concept TriviallyConstructible = __is_trivially_constructible(T, Args...); |
| 34 |
// { dg-message "'S' is not trivially default constructible" "" { target *-*-* } .-1 } |
| 35 |
// { dg-message "'S' is not trivially constructible from 'int'" "" { target *-*-* } .-2 } |
| 36 |
// { dg-message "'S' is not trivially constructible from 'int, char'" "" { target *-*-* } .-3 } |
| 37 |
|
| 38 |
template<class T, class... Args> |
| 39 |
concept NothrowConstructible = __is_nothrow_constructible(T, Args...); |
| 40 |
// { dg-message "'S' is not nothrow default constructible" "" { target *-*-* } .-1 } |
| 41 |
// { dg-message "'S' is not nothrow constructible from 'int'" "" { target *-*-* } .-2 } |
| 42 |
// { dg-message "'S' is not nothrow constructible from 'int, char'" "" { target *-*-* } .-3 } |
| 43 |
|
| 44 |
template<class T> |
| 45 |
concept UniqueObjReps = __has_unique_object_representations(T); |
| 46 |
// { dg-message "'S' does not have unique object representations" "" { target *-*-* } .-1 } |
| 47 |
|
| 48 |
static_assert(Aggregate<S>); // { dg-error "assert" } |
| 49 |
static_assert(TriviallyCopyable<S>); // { dg-error "assert" } |
| 50 |
static_assert(Assignable<S, int>); // { dg-error "assert" } |
| 51 |
static_assert(TriviallyAssignable<S, int>); // { dg-error "assert" } |
| 52 |
static_assert(NothrowAssignable<S, int>); // { dg-error "assert" } |
| 53 |
|
| 54 |
static_assert(Constructible<S>); // { dg-error "assert" } |
| 55 |
static_assert(Constructible<S, int>); // { dg-error "assert" } |
| 56 |
static_assert(Constructible<S, int, char>); // { dg-error "assert" } |
| 57 |
|
| 58 |
static_assert(TriviallyConstructible<S>); // { dg-error "assert" } |
| 59 |
static_assert(TriviallyConstructible<S, int>); // { dg-error "assert" } |
| 60 |
static_assert(TriviallyConstructible<S, int, char>); // { dg-error "assert" } |
| 61 |
|
| 62 |
static_assert(NothrowConstructible<S>); // { dg-error "assert" } |
| 63 |
static_assert(NothrowConstructible<S, int>); // { dg-error "assert" } |
| 64 |
static_assert(NothrowConstructible<S, int, char>); // { dg-error "assert" } |
| 65 |
|
| 66 |
static_assert(UniqueObjReps<S>); // { dg-error "assert" } |