1
1
// RUN: %clang_cc1 -fsyntax-only -verify -std=c++20 %s
2
2
3
- static_assert (!__builtin_lt_synthesises_from_spaceship ()); // expected-error {{expected a type}}
4
- static_assert (!__builtin_lt_synthesises_from_spaceship (int )); // expected-error {{type trait requires 2 arguments; have 1 argument}}
5
- static_assert (!__builtin_lt_synthesises_from_spaceship (int , int , int )); // expected-error {{type trait requires 2 arguments; have 3 argument}}
6
- static_assert (!__builtin_lt_synthesises_from_spaceship (int , 0 )); // expected-error {{expected a type}}
7
-
8
- static_assert (!__builtin_le_synthesises_from_spaceship ()); // expected-error {{expected a type}}
9
- static_assert (!__builtin_le_synthesises_from_spaceship (int )); // expected-error {{type trait requires 2 arguments; have 1 argument}}
10
- static_assert (!__builtin_le_synthesises_from_spaceship (int , int , int )); // expected-error {{type trait requires 2 arguments; have 3 argument}}
11
- static_assert (!__builtin_le_synthesises_from_spaceship (int , 0 )); // expected-error {{expected a type}}
12
-
13
- static_assert (!__builtin_gt_synthesises_from_spaceship ()); // expected-error {{expected a type}}
14
- static_assert (!__builtin_gt_synthesises_from_spaceship (int )); // expected-error {{type trait requires 2 arguments; have 1 argument}}
15
- static_assert (!__builtin_gt_synthesises_from_spaceship (int , int , int )); // expected-error {{type trait requires 2 arguments; have 3 argument}}
16
- static_assert (!__builtin_gt_synthesises_from_spaceship (int , 0 )); // expected-error {{expected a type}}
17
-
18
- static_assert (!__builtin_ge_synthesises_from_spaceship ()); // expected-error {{expected a type}}
19
- static_assert (!__builtin_ge_synthesises_from_spaceship (int )); // expected-error {{type trait requires 2 arguments; have 1 argument}}
20
- static_assert (!__builtin_ge_synthesises_from_spaceship (int , int , int )); // expected-error {{type trait requires 2 arguments; have 3 argument}}
21
- static_assert (!__builtin_ge_synthesises_from_spaceship (int , 0 )); // expected-error {{expected a type}}
3
+ static_assert (!__builtin_lt_synthesizes_from_spaceship ()); // expected-error {{expected a type}}
4
+ static_assert (!__builtin_lt_synthesizes_from_spaceship (int )); // expected-error {{type trait requires 2 arguments; have 1 argument}}
5
+ static_assert (!__builtin_lt_synthesizes_from_spaceship (int , int , int )); // expected-error {{type trait requires 2 arguments; have 3 argument}}
6
+ static_assert (!__builtin_lt_synthesizes_from_spaceship (int , 0 )); // expected-error {{expected a type}}
7
+
8
+ static_assert (!__builtin_le_synthesizes_from_spaceship ()); // expected-error {{expected a type}}
9
+ static_assert (!__builtin_le_synthesizes_from_spaceship (int )); // expected-error {{type trait requires 2 arguments; have 1 argument}}
10
+ static_assert (!__builtin_le_synthesizes_from_spaceship (int , int , int )); // expected-error {{type trait requires 2 arguments; have 3 argument}}
11
+ static_assert (!__builtin_le_synthesizes_from_spaceship (int , 0 )); // expected-error {{expected a type}}
12
+
13
+ static_assert (!__builtin_gt_synthesizes_from_spaceship ()); // expected-error {{expected a type}}
14
+ static_assert (!__builtin_gt_synthesizes_from_spaceship (int )); // expected-error {{type trait requires 2 arguments; have 1 argument}}
15
+ static_assert (!__builtin_gt_synthesizes_from_spaceship (int , int , int )); // expected-error {{type trait requires 2 arguments; have 3 argument}}
16
+ static_assert (!__builtin_gt_synthesizes_from_spaceship (int , 0 )); // expected-error {{expected a type}}
17
+
18
+ static_assert (!__builtin_ge_synthesizes_from_spaceship ()); // expected-error {{expected a type}}
19
+ static_assert (!__builtin_ge_synthesizes_from_spaceship (int )); // expected-error {{type trait requires 2 arguments; have 1 argument}}
20
+ static_assert (!__builtin_ge_synthesizes_from_spaceship (int , int , int )); // expected-error {{type trait requires 2 arguments; have 3 argument}}
21
+ static_assert (!__builtin_ge_synthesizes_from_spaceship (int , 0 )); // expected-error {{expected a type}}
22
22
23
23
namespace std {
24
24
struct strong_ordering {
@@ -35,10 +35,10 @@ struct DefaultSpaceship {
35
35
friend auto operator <=>(DefaultSpaceship, DefaultSpaceship) = default ;
36
36
};
37
37
38
- static_assert (__builtin_lt_synthesises_from_spaceship (const DefaultSpaceship&, const DefaultSpaceship&));
39
- static_assert (__builtin_le_synthesises_from_spaceship (const DefaultSpaceship&, const DefaultSpaceship&));
40
- static_assert (__builtin_gt_synthesises_from_spaceship (const DefaultSpaceship&, const DefaultSpaceship&));
41
- static_assert (__builtin_ge_synthesises_from_spaceship (const DefaultSpaceship&, const DefaultSpaceship&));
38
+ static_assert (__builtin_lt_synthesizes_from_spaceship (const DefaultSpaceship&, const DefaultSpaceship&));
39
+ static_assert (__builtin_le_synthesizes_from_spaceship (const DefaultSpaceship&, const DefaultSpaceship&));
40
+ static_assert (__builtin_gt_synthesizes_from_spaceship (const DefaultSpaceship&, const DefaultSpaceship&));
41
+ static_assert (__builtin_ge_synthesizes_from_spaceship (const DefaultSpaceship&, const DefaultSpaceship&));
42
42
43
43
struct CustomSpaceship {
44
44
int i;
@@ -48,10 +48,10 @@ struct CustomSpaceship {
48
48
}
49
49
};
50
50
51
- static_assert (__builtin_lt_synthesises_from_spaceship (const CustomSpaceship&, const CustomSpaceship&));
52
- static_assert (__builtin_le_synthesises_from_spaceship (const CustomSpaceship&, const CustomSpaceship&));
53
- static_assert (__builtin_gt_synthesises_from_spaceship (const CustomSpaceship&, const CustomSpaceship&));
54
- static_assert (__builtin_ge_synthesises_from_spaceship (const CustomSpaceship&, const CustomSpaceship&));
51
+ static_assert (__builtin_lt_synthesizes_from_spaceship (const CustomSpaceship&, const CustomSpaceship&));
52
+ static_assert (__builtin_le_synthesizes_from_spaceship (const CustomSpaceship&, const CustomSpaceship&));
53
+ static_assert (__builtin_gt_synthesizes_from_spaceship (const CustomSpaceship&, const CustomSpaceship&));
54
+ static_assert (__builtin_ge_synthesizes_from_spaceship (const CustomSpaceship&, const CustomSpaceship&));
55
55
56
56
struct CustomLT {
57
57
int i;
@@ -61,10 +61,10 @@ struct CustomLT {
61
61
}
62
62
};
63
63
64
- static_assert (!__builtin_lt_synthesises_from_spaceship (const CustomLT&, const CustomLT&));
65
- static_assert (!__builtin_le_synthesises_from_spaceship (const CustomLT&, const CustomLT&));
66
- static_assert (!__builtin_gt_synthesises_from_spaceship (const CustomLT&, const CustomLT&));
67
- static_assert (!__builtin_ge_synthesises_from_spaceship (const CustomLT&, const CustomLT&));
64
+ static_assert (!__builtin_lt_synthesizes_from_spaceship (const CustomLT&, const CustomLT&));
65
+ static_assert (!__builtin_le_synthesizes_from_spaceship (const CustomLT&, const CustomLT&));
66
+ static_assert (!__builtin_gt_synthesizes_from_spaceship (const CustomLT&, const CustomLT&));
67
+ static_assert (!__builtin_ge_synthesizes_from_spaceship (const CustomLT&, const CustomLT&));
68
68
69
69
struct CustomLE {
70
70
int i;
@@ -74,10 +74,10 @@ struct CustomLE {
74
74
}
75
75
};
76
76
77
- static_assert (!__builtin_lt_synthesises_from_spaceship (const CustomLE&, const CustomLE&));
78
- static_assert (!__builtin_le_synthesises_from_spaceship (const CustomLE&, const CustomLE&));
79
- static_assert (!__builtin_gt_synthesises_from_spaceship (const CustomLE&, const CustomLE&));
80
- static_assert (!__builtin_ge_synthesises_from_spaceship (const CustomLE&, const CustomLE&));
77
+ static_assert (!__builtin_lt_synthesizes_from_spaceship (const CustomLE&, const CustomLE&));
78
+ static_assert (!__builtin_le_synthesizes_from_spaceship (const CustomLE&, const CustomLE&));
79
+ static_assert (!__builtin_gt_synthesizes_from_spaceship (const CustomLE&, const CustomLE&));
80
+ static_assert (!__builtin_ge_synthesizes_from_spaceship (const CustomLE&, const CustomLE&));
81
81
82
82
struct CustomGT {
83
83
int i;
@@ -87,10 +87,10 @@ struct CustomGT {
87
87
}
88
88
};
89
89
90
- static_assert (!__builtin_lt_synthesises_from_spaceship (const CustomGT&, const CustomGT&));
91
- static_assert (!__builtin_le_synthesises_from_spaceship (const CustomGT&, const CustomGT&));
92
- static_assert (!__builtin_gt_synthesises_from_spaceship (const CustomGT&, const CustomGT&));
93
- static_assert (!__builtin_ge_synthesises_from_spaceship (const CustomGT&, const CustomGT&));
90
+ static_assert (!__builtin_lt_synthesizes_from_spaceship (const CustomGT&, const CustomGT&));
91
+ static_assert (!__builtin_le_synthesizes_from_spaceship (const CustomGT&, const CustomGT&));
92
+ static_assert (!__builtin_gt_synthesizes_from_spaceship (const CustomGT&, const CustomGT&));
93
+ static_assert (!__builtin_ge_synthesizes_from_spaceship (const CustomGT&, const CustomGT&));
94
94
95
95
struct CustomGE {
96
96
int i;
@@ -100,10 +100,10 @@ struct CustomGE {
100
100
}
101
101
};
102
102
103
- static_assert (!__builtin_lt_synthesises_from_spaceship (const CustomGE&, const CustomGE&));
104
- static_assert (!__builtin_le_synthesises_from_spaceship (const CustomGE&, const CustomGE&));
105
- static_assert (!__builtin_gt_synthesises_from_spaceship (const CustomGE&, const CustomGE&));
106
- static_assert (!__builtin_ge_synthesises_from_spaceship (const CustomGE&, const CustomGE&));
103
+ static_assert (!__builtin_lt_synthesizes_from_spaceship (const CustomGE&, const CustomGE&));
104
+ static_assert (!__builtin_le_synthesizes_from_spaceship (const CustomGE&, const CustomGE&));
105
+ static_assert (!__builtin_gt_synthesizes_from_spaceship (const CustomGE&, const CustomGE&));
106
+ static_assert (!__builtin_ge_synthesizes_from_spaceship (const CustomGE&, const CustomGE&));
107
107
108
108
struct CustomLTAndSpaceship {
109
109
int i;
@@ -117,10 +117,10 @@ struct CustomLTAndSpaceship {
117
117
}
118
118
};
119
119
120
- static_assert (!__builtin_lt_synthesises_from_spaceship (const CustomLTAndSpaceship&, const CustomLTAndSpaceship&));
121
- static_assert (__builtin_le_synthesises_from_spaceship (const CustomLTAndSpaceship&, const CustomLTAndSpaceship&));
122
- static_assert (__builtin_gt_synthesises_from_spaceship (const CustomLTAndSpaceship&, const CustomLTAndSpaceship&));
123
- static_assert (__builtin_ge_synthesises_from_spaceship (const CustomLTAndSpaceship&, const CustomLTAndSpaceship&));
120
+ static_assert (!__builtin_lt_synthesizes_from_spaceship (const CustomLTAndSpaceship&, const CustomLTAndSpaceship&));
121
+ static_assert (__builtin_le_synthesizes_from_spaceship (const CustomLTAndSpaceship&, const CustomLTAndSpaceship&));
122
+ static_assert (__builtin_gt_synthesizes_from_spaceship (const CustomLTAndSpaceship&, const CustomLTAndSpaceship&));
123
+ static_assert (__builtin_ge_synthesizes_from_spaceship (const CustomLTAndSpaceship&, const CustomLTAndSpaceship&));
124
124
125
125
struct CustomLEAndSpaceship {
126
126
int i;
@@ -134,10 +134,10 @@ struct CustomLEAndSpaceship {
134
134
}
135
135
};
136
136
137
- static_assert (__builtin_lt_synthesises_from_spaceship (const CustomLEAndSpaceship&, const CustomLEAndSpaceship&));
138
- static_assert (!__builtin_le_synthesises_from_spaceship (const CustomLEAndSpaceship&, const CustomLEAndSpaceship&));
139
- static_assert (__builtin_gt_synthesises_from_spaceship (const CustomLEAndSpaceship&, const CustomLEAndSpaceship&));
140
- static_assert (__builtin_ge_synthesises_from_spaceship (const CustomLEAndSpaceship&, const CustomLEAndSpaceship&));
137
+ static_assert (__builtin_lt_synthesizes_from_spaceship (const CustomLEAndSpaceship&, const CustomLEAndSpaceship&));
138
+ static_assert (!__builtin_le_synthesizes_from_spaceship (const CustomLEAndSpaceship&, const CustomLEAndSpaceship&));
139
+ static_assert (__builtin_gt_synthesizes_from_spaceship (const CustomLEAndSpaceship&, const CustomLEAndSpaceship&));
140
+ static_assert (__builtin_ge_synthesizes_from_spaceship (const CustomLEAndSpaceship&, const CustomLEAndSpaceship&));
141
141
142
142
struct CustomGTAndSpaceship {
143
143
int i;
@@ -151,10 +151,10 @@ struct CustomGTAndSpaceship {
151
151
}
152
152
};
153
153
154
- static_assert (__builtin_lt_synthesises_from_spaceship (const CustomGTAndSpaceship&, const CustomGTAndSpaceship&));
155
- static_assert (__builtin_le_synthesises_from_spaceship (const CustomGTAndSpaceship&, const CustomGTAndSpaceship&));
156
- static_assert (!__builtin_gt_synthesises_from_spaceship (const CustomGTAndSpaceship&, const CustomGTAndSpaceship&));
157
- static_assert (__builtin_ge_synthesises_from_spaceship (const CustomGTAndSpaceship&, const CustomGTAndSpaceship&));
154
+ static_assert (__builtin_lt_synthesizes_from_spaceship (const CustomGTAndSpaceship&, const CustomGTAndSpaceship&));
155
+ static_assert (__builtin_le_synthesizes_from_spaceship (const CustomGTAndSpaceship&, const CustomGTAndSpaceship&));
156
+ static_assert (!__builtin_gt_synthesizes_from_spaceship (const CustomGTAndSpaceship&, const CustomGTAndSpaceship&));
157
+ static_assert (__builtin_ge_synthesizes_from_spaceship (const CustomGTAndSpaceship&, const CustomGTAndSpaceship&));
158
158
159
159
struct CustomGEAndSpaceship {
160
160
int i;
@@ -168,10 +168,10 @@ struct CustomGEAndSpaceship {
168
168
}
169
169
};
170
170
171
- static_assert (__builtin_lt_synthesises_from_spaceship (const CustomGEAndSpaceship&, const CustomGEAndSpaceship&));
172
- static_assert (__builtin_le_synthesises_from_spaceship (const CustomGEAndSpaceship&, const CustomGEAndSpaceship&));
173
- static_assert (__builtin_gt_synthesises_from_spaceship (const CustomGEAndSpaceship&, const CustomGEAndSpaceship&));
174
- static_assert (!__builtin_ge_synthesises_from_spaceship (const CustomGEAndSpaceship&, const CustomGEAndSpaceship&));
171
+ static_assert (__builtin_lt_synthesizes_from_spaceship (const CustomGEAndSpaceship&, const CustomGEAndSpaceship&));
172
+ static_assert (__builtin_le_synthesizes_from_spaceship (const CustomGEAndSpaceship&, const CustomGEAndSpaceship&));
173
+ static_assert (__builtin_gt_synthesizes_from_spaceship (const CustomGEAndSpaceship&, const CustomGEAndSpaceship&));
174
+ static_assert (!__builtin_ge_synthesizes_from_spaceship (const CustomGEAndSpaceship&, const CustomGEAndSpaceship&));
175
175
176
176
struct DefaultedCmpAndSpaceship {
177
177
int i;
@@ -187,10 +187,10 @@ struct DefaultedCmpAndSpaceship {
187
187
};
188
188
189
189
// TODO: This should probably return true
190
- static_assert (!__builtin_lt_synthesises_from_spaceship (const DefaultedCmpAndSpaceship&, const DefaultedCmpAndSpaceship&));
191
- static_assert (!__builtin_le_synthesises_from_spaceship (const DefaultedCmpAndSpaceship&, const DefaultedCmpAndSpaceship&));
192
- static_assert (!__builtin_gt_synthesises_from_spaceship (const DefaultedCmpAndSpaceship&, const DefaultedCmpAndSpaceship&));
193
- static_assert (!__builtin_ge_synthesises_from_spaceship (const DefaultedCmpAndSpaceship&, const DefaultedCmpAndSpaceship&));
190
+ static_assert (!__builtin_lt_synthesizes_from_spaceship (const DefaultedCmpAndSpaceship&, const DefaultedCmpAndSpaceship&));
191
+ static_assert (!__builtin_le_synthesizes_from_spaceship (const DefaultedCmpAndSpaceship&, const DefaultedCmpAndSpaceship&));
192
+ static_assert (!__builtin_gt_synthesizes_from_spaceship (const DefaultedCmpAndSpaceship&, const DefaultedCmpAndSpaceship&));
193
+ static_assert (!__builtin_ge_synthesizes_from_spaceship (const DefaultedCmpAndSpaceship&, const DefaultedCmpAndSpaceship&));
194
194
195
195
struct DifferentTypes {
196
196
int i;
@@ -200,13 +200,13 @@ struct DifferentTypes {
200
200
}
201
201
};
202
202
203
- static_assert (__builtin_lt_synthesises_from_spaceship (const DifferentTypes&, const int &));
204
- static_assert (__builtin_le_synthesises_from_spaceship (const DifferentTypes&, const int &));
205
- static_assert (__builtin_gt_synthesises_from_spaceship (const DifferentTypes&, const int &));
206
- static_assert (__builtin_ge_synthesises_from_spaceship (const DifferentTypes&, const int &));
203
+ static_assert (__builtin_lt_synthesizes_from_spaceship (const DifferentTypes&, const int &));
204
+ static_assert (__builtin_le_synthesizes_from_spaceship (const DifferentTypes&, const int &));
205
+ static_assert (__builtin_gt_synthesizes_from_spaceship (const DifferentTypes&, const int &));
206
+ static_assert (__builtin_ge_synthesizes_from_spaceship (const DifferentTypes&, const int &));
207
207
208
208
// TODO: Should this return true? It's technically not synthesized from spaceship, but it behaves exactly as-if it was
209
- static_assert (!__builtin_lt_synthesises_from_spaceship (int , int ));
210
- static_assert (!__builtin_le_synthesises_from_spaceship (int , int ));
211
- static_assert (!__builtin_gt_synthesises_from_spaceship (int , int ));
212
- static_assert (!__builtin_ge_synthesises_from_spaceship (int , int ));
209
+ static_assert (!__builtin_lt_synthesizes_from_spaceship (int , int ));
210
+ static_assert (!__builtin_le_synthesizes_from_spaceship (int , int ));
211
+ static_assert (!__builtin_gt_synthesizes_from_spaceship (int , int ));
212
+ static_assert (!__builtin_ge_synthesizes_from_spaceship (int , int ));
0 commit comments