aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/concepts/traits1.C
blob: 27610e25a5403ab43696c7e9811fcd2ca0c43987 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
// { dg-do compile { target c++17 } }
// { dg-options "-fconcepts" }

template<typename T>
  concept bool Nothrow_assignable() { return __has_nothrow_assign(T); }

template<typename T>
  concept bool Nothrow_constructible() { return __has_nothrow_constructor(T); }

template<typename T>
  concept bool Nothrow_copyable() { return __has_nothrow_copy(T); }

template<typename T>
  concept bool Trivially_assignable() { return __has_trivial_assign(T); }

template<typename T>
  concept bool Trivially_constructible() { return __has_trivial_constructor(T); }

template<typename T>
  concept bool Trivially_copyable() { return __has_trivial_copy(T); }

template<typename T>
  concept bool Trivially_destructible() { return __has_trivial_destructor(T); }

template<typename T>
  concept bool Dynamically_destructible() { return __has_virtual_destructor(T); }

template<typename T>
  concept bool Abstract() { return __is_abstract(T); }

template<typename T>
  concept bool Polymorphic() { return __is_polymorphic(T); }

template<typename T>
  concept bool Class() { return __is_class(T); }

template<typename T>
  concept bool Empty() { return __is_empty(T); }

template<typename T>
  concept bool Enum() { return __is_enum(T); }

template<typename T>
  concept bool Final() { return __is_final(T); }

template<typename T>
  concept bool Literal_type() { return __is_literal_type(T); }

template<typename T>
  concept bool Pod() { return __is_pod(T); }

template<typename T>
  concept bool Standard_layout() { return __is_standard_layout(T); }

template<typename T>
  concept bool Trivial() { return __is_trivial(T); }

template<typename T>
  concept bool Union() { return __is_union(T); }

template<Nothrow_assignable T> void f1() { }
template<Nothrow_copyable T> void f2() { }
template<Nothrow_constructible T> void f3() { }
template<Trivially_assignable T> void f4() { }
template<Trivially_copyable T> void f5() { }
template<Trivially_constructible T> void f6() { }
template<Trivially_destructible T> void f7() { }
template<Dynamically_destructible T> void f8() { }
template<Class T> void f9() { }
template<Empty T> void f10() { }
template<Standard_layout T> void f11() { }
template<Pod T> void f12() { }
template<Trivial T> void f13() { }
template<Polymorphic T> void f14() { }
template<Abstract T> void f15() { }
template<Final T> void f16() { }
template<Union T> void f17() { }
template<Enum T> void f18() { }

int main() {
  f1<void>(); // { dg-error "cannot call" }
  f2<void>(); // { dg-error "cannot call" }
  f3<void>(); // { dg-error "cannot call" }
  f4<void>(); // { dg-error "cannot call" }
  f5<void>(); // { dg-error "cannot call" }
  f6<void>(); // { dg-error "cannot call" }
  f7<void>(); // { dg-error "cannot call" }
  f8<void>(); // { dg-error "cannot call" }
  f9<void>(); // { dg-error "cannot call" }
  f10<void>(); // { dg-error "cannot call" }
  f11<void>(); // { dg-error "cannot call" }
  f12<void>(); // { dg-error "cannot call" }
  f13<void>(); // { dg-error "cannot call" }
  f14<void>(); // { dg-error "cannot call" }
  f15<void>(); // { dg-error "cannot call" }
  f16<void>(); // { dg-error "cannot call" }
  f17<void>(); // { dg-error "cannot call" }
}