111
|
1 // { dg-do compile { target c++11 } }
|
|
2
|
|
3 struct A { };
|
|
4 struct B { B(); operator int(); };
|
|
5 struct C {
|
|
6 C() = default;
|
|
7 C(const C&);
|
|
8 C(C&&) = default;
|
|
9 C& operator=(C&&);
|
|
10 C& operator= (const C&) = default;
|
|
11 };
|
|
12 struct D { ~D() {} };
|
|
13
|
|
14 #define SA(X) static_assert((X),#X)
|
|
15
|
|
16 SA(__is_trivially_constructible(A));
|
|
17 SA(__is_trivially_constructible(A,A));
|
|
18 SA(!__is_trivially_constructible(B));
|
|
19 SA(__is_trivially_constructible(B,B));
|
|
20
|
|
21 SA(!__is_trivially_constructible(A,B));
|
|
22 SA(!__is_trivially_constructible(B,A));
|
|
23
|
|
24 SA(__is_trivially_constructible(C));
|
|
25 SA(__is_trivially_constructible(C,C));
|
|
26 SA(!__is_trivially_constructible(C,C&));
|
|
27 SA(__is_trivially_assignable(C,C&));
|
|
28 SA(!__is_trivially_assignable(C,C));
|
|
29 SA(!__is_trivially_assignable(C,C&&));
|
|
30 SA(!__is_trivially_assignable(void,int));
|
|
31 SA(!__is_trivially_assignable(const void,int));
|
|
32 SA(!__is_trivially_assignable(volatile void,int));
|
|
33 SA(!__is_trivially_assignable(const volatile void,int));
|
|
34
|
|
35 SA(__is_trivially_constructible(int,int));
|
|
36 SA(__is_trivially_constructible(int,double));
|
|
37 SA(!__is_trivially_constructible(int,B));
|
|
38 SA(!__is_trivially_constructible(void,int));
|
|
39 SA(!__is_trivially_constructible(const void,int));
|
|
40 SA(!__is_trivially_constructible(volatile void,int));
|
|
41 SA(!__is_trivially_constructible(const volatile void,int));
|
131
|
42 SA(!__is_trivially_constructible(int, void*));
|
|
43 SA(!__is_trivially_constructible(int, int*));
|
|
44 SA(!__is_trivially_constructible(int, const int*));
|
|
45 SA(!__is_trivially_constructible(int*, void*));
|
|
46 SA(!__is_trivially_constructible(int*, const int*));
|
111
|
47
|
|
48 SA(!__is_trivially_constructible(D));
|
|
49
|
|
50 SA(__is_trivially_copyable(int));
|
|
51 SA(!__is_trivially_copyable(volatile int));
|
|
52
|
|
53 struct E1 {const int val;};
|
|
54 SA(__is_trivially_copyable(E1));
|
|
55 struct E2 {int& val;};
|
|
56 SA(__is_trivially_copyable(E2));
|