Debian Codegraph @

gcc/testsuite/g++.dg/ext/sve-sizeless-2.C

raw
1 // { dg-do compile { target aarch64*-*-* } }
2 // { dg-options "-Wclass-memaccess -msve-vector-bits=256" }
3
4 #pragma GCC target "+sve"
5
6 typedef __SIZE_TYPE__ size_t;
7 inline void *operator new (size_t, void *__p) throw() { return __p; }
8
9 #include <arm_sve.h>
10
11 typedef signed char int8x32_t __attribute__((__vector_size__ (32)));
12
13 // Sizeless objects with global scope.
14
15 svint8_t global_sve_sc; // { dg-error {SVE type 'svint8_t' does not have a fixed size} }
16 static svint8_t local_sve_sc; // { dg-error {SVE type 'svint8_t' does not have a fixed size} }
17 extern svint8_t extern_sve_sc; // { dg-error {SVE type 'svint8_t' does not have a fixed size} }
18 __thread svint8_t tls_sve_sc; // { dg-error {variables of type 'svint8_t' cannot have thread-local storage duration} }
19
20 // Sizeless arrays.
21
22 typedef svint8_t array_type[2]; // { dg-error {array elements cannot have SVE type 'svint8_t'} }
23 extern svint8_t extern_array[]; // { dg-error {array elements cannot have SVE type 'svint8_t'} }
24
25 // Sizeless member variables.
26
27 struct struct1 {
28 svint8_t a; // { dg-error {member variables cannot have SVE type 'svint8_t'} }
29 };
30
31 union union1 {
32 svint8_t a; // { dg-error {member variables cannot have SVE type 'svint8_t'} }
33 };
34
35 #if __cplusplus >= 201103L
36 struct static_sve_sc {
37 static svint8_t sve_sc1 = {}; // { dg-error {SVE type 'svint8_t' does not have a fixed size} "" { target c++11 } }
38 };
39 #endif
40
41 // Sizeless member variables in templated structures.
42
43 template<typename T>
44 struct templated_struct1 {
45 svint8_t a; // { dg-error {member variables cannot have SVE type 'svint8_t'} }
46 };
47
48 template<typename T>
49 struct templated_struct2 {
50 T a; // { dg-error {member variables cannot have SVE type '(svint8_t|__SVInt8_t)'} }
51 };
52
53 template class templated_struct2<svint8_t>;
54
55 template<typename T>
56 struct templated_struct3 {
57 T &a;
58 };
59
60 template class templated_struct3<svint8_t>;
61
62 #if __cplusplus >= 201103L
63 template<typename T>
64 struct templated_struct4 {
65 static T a; // { dg-error {SVE type '(svint8_t|__SVInt8_t)' does not have a fixed size} "" { target c++11 } }
66 static T b = {}; // { dg-error {SVE type '(svint8_t|__SVInt8_t)' does not have a fixed size} "" { target c++11 } }
67 };
68
69 template class templated_struct4<svint8_t>;
70 #endif
71
72 template<typename T> struct templated_struct5 : T {}; // { dg-error {base type '[^']*' fails to be a struct or class type} }
73 template class templated_struct5<svint8_t>;
74
75 template<typename T, unsigned N> struct templated_struct6 { T x[N]; }; // { dg-error {array elements cannot have SVE type '(__SVInt8_t|svint8_t)'} }
76 template class templated_struct6<svint8_t, 2>;
77
78 template<typename T>
79 struct templated_struct7 {
80 static const int size = sizeof (T); // { dg-error {SVE type '(__SVInt8_t|svint8_t)' does not have a fixed size} }
81 #if __cplusplus >= 201103L
82 static const int align = alignof (T); // { dg-error {SVE type '(__SVInt8_t|svint8_t)' does not have a defined alignment} "" { target c++11 } }
83 #endif
84
85 void f1 (T (&)[2]); // { dg-error {array elements cannot have SVE type '(__SVInt8_t|svint8_t)'} }
86 #if __cplusplus >= 201103L
87 auto f2 () -> decltype (new T); // { dg-error {cannot allocate objects with SVE type '(__SVInt8_t|svint8_t)'} "" { target c++11 } }
88 auto f3 (T *a) -> decltype (delete a); // { dg-error {cannot delete objects with SVE type '(__SVInt8_t|svint8_t)'} "" { target c++11 } }
89 #else
90 void f2 () throw (T); // { dg-error {cannot throw or catch SVE type '(__SVInt8_t|svint8_t)'} "" { target c++98_only } }
91 #endif
92 };
93 template class templated_struct7<svint8_t>;
94
95 template<typename T> struct templated_struct8 { typedef int type; };
96
97 template<typename T>
98 void sfinae_f1 (typename templated_struct8<T[2]>::type);
99 template<typename T>
100 void sfinae_f1 (T &);
101
102 #if __cplusplus >= 201103L
103 template<int N> using typedef_sizeless1 = svint8_t;
104 template<int N> using typedef_sizeless1 = svint8_t;
105 template<typename T> using array = T[2]; // { dg-error {array elements cannot have SVE type '(svint8_t|__SVInt8_t)'} "" { target c++11 } }
106 #endif
107
108 // Pointers to sizeless types.
109
110 svint8_t *global_sve_sc_ptr;
111
112 // Sizeless arguments and return values.
113
114 void ext_consume_sve_sc (svint8_t);
115 void ext_consume_const_int_ref (const int &);
116 void ext_consume_varargs (int, ...);
117 svint8_t ext_produce_sve_sc ();
118
119 // Sizeless types in throw specifications.
120
121 #if __cplusplus < 201103L
122 void thrower1 () throw (svint8_t); // { dg-error {cannot throw or catch SVE type 'svint8_t'} "" { target c++98_only } }
123 void thrower2 () throw (svint8_t); // { dg-error {cannot throw or catch SVE type 'svint8_t'} "" { target c++98_only } }
124 void thrower3 () throw (svint8_t); // { dg-error {cannot throw or catch SVE type 'svint8_t'} "" { target c++98_only } }
125 #endif
126
127 extern int bar (void);
128
129 // Main tests for statements and expressions.
130
131 void
132 statements (int n)
133 {
134 // Local declarations.
135
136 svint8_t sve_sc1, sve_sc2;
137 volatile svint8_t volatile_sve_sc1;
138 int8x32_t gnu_sc1;
139 svint16_t sve_sh1;
140
141 // Layout queries.
142
143 sizeof (svint8_t); // { dg-error {SVE type 'svint8_t' does not have a fixed size} }
144 sizeof (sve_sc1); // { dg-error {SVE type 'svint8_t' does not have a fixed size} }
145 sizeof (ext_produce_sve_sc ()); // { dg-error {SVE type 'svint8_t' does not have a fixed size} }
146 __alignof (svint8_t); // { dg-error {SVE type 'svint8_t' does not have a defined alignment} }
147 __alignof (sve_sc1); // { dg-error {SVE type 'svint8_t' does not have a defined alignment} }
148 __alignof (ext_produce_sve_sc ()); // { dg-error {SVE type 'svint8_t' does not have a defined alignment} }
149
150 #if __cplusplus >= 201103L
151 array<svint8_t> foo = {}; // { dg-message {required from here} "" { target c++11 } }
152 #endif
153
154 // Initialization.
155
156 int init_int1 = sve_sc1; // { dg-error {cannot convert 'svint8_t' to 'int' in initialization} }
157 int init_int2 = { sve_sc1 }; // { dg-error {cannot convert 'svint8_t' to 'int' in initialization} }
158
159 svint8_t init_sve_sc1 (sve_sc1);
160 svint8_t init_sve_sc2 (sve_sh1); // { dg-error {cannot convert 'svint16_t' to 'svint8_t'} }
161 svint8_t init_sve_sc3 = sve_sc1;
162 svint8_t init_sve_sc4 = sve_sh1; // { dg-error {cannot convert 'svint16_t' to 'svint8_t'} }
163 svint8_t init_sve_sc5 = {};
164 svint8_t init_sve_sc6 = { sve_sc1 }; // { dg-error {cannot convert 'svint8_t' to 'signed char'} "" { target c++98_only } }
165 svint8_t init_sve_sc7 = { sve_sh1 }; // { dg-error {cannot convert 'svint16_t' to 'signed char'} }
166 svint32_t init_sve_vc1 = { 0, 1 };
167 svint32_t init_sve_vc2 = { 0, bar () };
168 svint32_t init_sve_vc3 = { bar (), n };
169 svint32_t init_sve_vc4 = { 0, 1, 2, 3, 4, 5, 6, 7 };
170 svint32_t init_sve_vc5 = { 0, 1, bar (), 3, 4, 5, n, 7 };
171 svint32_t init_sve_vc6 = { 0, 1, 2, 3, 4, 5, 6, 7, 8 }; // { dg-error {too many initializers for 'svint32_t'} }
172 svint32_t init_sve_vc7 = { 0, 1, 2, 3, bar (), 5, 6, 7, n }; // { dg-error {too many initializers for 'svint32_t'} }
173 svint32_t init_sve_vc8 = { 0, bar (), 2, 3, 4, n, 5, 6, 7, 8, 9 }; // { dg-error {too many initializers for 'svint32_t'} }
174 svint32_t init_sve_vc9 = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; // { dg-error {too many initializers for 'svint32_t'} }
175
176 // Constructor calls.
177
178 (0, svint8_t ());
179
180 // Lvalue reference binding
181
182 svint8_t &lvalue_ref_sve_sc1 = sve_sc1;
183 svint8_t &lvalue_ref_sve_sc2 = ext_produce_sve_sc (); // { dg-error {cannot bind non-const lvalue reference of type 'svint8_t&' to an rvalue of type 'svint8_t'} }
184 svint8_t &lvalue_ref_sve_sc3 = sve_sh1; // { dg-error {invalid initialization of reference of type 'svint8_t&' from expression of type 'svint16_t'} }
185
186 const svint8_t &const_lvalue_ref_sve_sc1 = sve_sc1;
187 const svint8_t &const_lvalue_ref_sve_sc2 = ext_produce_sve_sc ();
188 const svint8_t &const_lvalue_ref_sve_sc3 = sve_sh1; // { dg-error {invalid initialization of reference of type 'const svint8_t&' from expression of type 'svint16_t'} }
189
190 // Compound literals.
191
192 (int) { sve_sc1 }; // { dg-error {cannot convert 'svint8_t' to 'int' in initialization} }
193
194 // Arrays.
195
196 svint8_t array[2]; // { dg-error {array elements cannot have SVE type 'svint8_t'} }
197 svint8_t zero_length_array[0]; // { dg-error {array elements cannot have SVE type 'svint8_t'} }
198 svint8_t empty_init_array[] = {}; // { dg-error {array elements cannot have SVE type 'svint8_t'} }
199
200 // Assignment.
201
202 n = sve_sc1; // { dg-error {cannot convert 'svint8_t' to 'int' in assignment} }
203
204 sve_sc1 = 0; // { dg-error {cannot convert 'int' to 'svint8_t' in assignment} }
205 sve_sc1 = sve_sc1;
206 sve_sc1 = gnu_sc1;
207 gnu_sc1 = sve_sc1;
208 sve_sc1 = sve_sh1; // { dg-error {cannot convert 'svint16_t' to 'svint8_t'} }
209
210 // Casting.
211
212 (void) sve_sc1;
213 (void) volatile_sve_sc1;
214 (void) *&volatile_sve_sc1;
215
216 // Addressing and dereferencing.
217
218 svint8_t *sve_sc_ptr = &sve_sc1;
219 int8x32_t *gnu_sc_ptr = &gnu_sc1;
220 sve_sc_ptr = (svint16_t *) 0; // { dg-error {cannot convert 'svint16_t\*' to 'svint8_t\*' in assignment} }
221
222 // Pointer assignment.
223
224 gnu_sc_ptr = sve_sc_ptr; // { dg-error {invalid conversion from 'svint8_t\*' to 'int8x32_t\*'} }
225 sve_sc_ptr = gnu_sc_ptr; // { dg-error {invalid conversion from 'int8x32_t\*'[^\n]* to 'svint8_t\*'} }
226
227 // Pointer arithmetic.
228
229 ++sve_sc_ptr; // { dg-error {arithmetic on pointer to SVE type 'svint8_t'} }
230 --sve_sc_ptr; // { dg-error {arithmetic on pointer to SVE type 'svint8_t'} }
231 sve_sc_ptr++; // { dg-error {arithmetic on pointer to SVE type 'svint8_t'} }
232 sve_sc_ptr--; // { dg-error {arithmetic on pointer to SVE type 'svint8_t'} }
233 sve_sc_ptr += 0; // { dg-error {arithmetic on pointer to SVE type 'svint8_t'} }
234 sve_sc_ptr += 1; // { dg-error {arithmetic on pointer to SVE type 'svint8_t'} }
235 sve_sc_ptr -= 0; // { dg-error {arithmetic on pointer to SVE type 'svint8_t'} }
236 sve_sc_ptr -= 1; // { dg-error {arithmetic on pointer to SVE type 'svint8_t'} }
237 sve_sc_ptr - sve_sc_ptr; // { dg-error {arithmetic on pointer to SVE type 'svint8_t'} }
238 gnu_sc_ptr - sve_sc_ptr; // { dg-error {invalid operands of types 'int8x32_t\*'[^\n]* and 'svint8_t\*' to binary 'operator-'} }
239 sve_sc_ptr - gnu_sc_ptr; // { dg-error {invalid operands of types 'svint8_t\*' and 'int8x32_t\*'[^\n]* to binary 'operator-'} }
240 sve_sc1 = sve_sc_ptr[0]; // { dg-error {arithmetic on pointer to SVE type 'svint8_t'} }
241 sve_sc1 = sve_sc_ptr[1]; // { dg-error {arithmetic on pointer to SVE type 'svint8_t'} }
242
243 // Pointer comparison.
244
245 sve_sc_ptr == &sve_sc1;
246 sve_sc_ptr != &sve_sc1;
247 sve_sc_ptr < &sve_sc1;
248 sve_sc_ptr <= &sve_sc1;
249 sve_sc_ptr > &sve_sc1;
250 sve_sc_ptr >= &sve_sc1;
251 gnu_sc_ptr == sve_sc_ptr; // { dg-error {comparison between distinct pointer types [^\n]*lacks a cast} }
252 gnu_sc_ptr != sve_sc_ptr; // { dg-error {comparison between distinct pointer types [^\n]*lacks a cast} }
253 gnu_sc_ptr < sve_sc_ptr; // { dg-error {comparison between distinct pointer types [^\n]*lacks a cast} }
254 gnu_sc_ptr <= sve_sc_ptr; // { dg-error {comparison between distinct pointer types [^\n]*lacks a cast} }
255 gnu_sc_ptr > sve_sc_ptr; // { dg-error {comparison between distinct pointer types [^\n]*lacks a cast} }
256 gnu_sc_ptr >= sve_sc_ptr; // { dg-error {comparison between distinct pointer types [^\n]*lacks a cast} }
257 sve_sc_ptr == gnu_sc_ptr; // { dg-error {comparison between distinct pointer types [^\n]*lacks a cast} }
258 sve_sc_ptr != gnu_sc_ptr; // { dg-error {comparison between distinct pointer types [^\n]*lacks a cast} }
259 sve_sc_ptr < gnu_sc_ptr; // { dg-error {comparison between distinct pointer types [^\n]*lacks a cast} }
260 sve_sc_ptr <= gnu_sc_ptr; // { dg-error {comparison between distinct pointer types [^\n]*lacks a cast} }
261 sve_sc_ptr > gnu_sc_ptr; // { dg-error {comparison between distinct pointer types [^\n]*lacks a cast} }
262 sve_sc_ptr >= gnu_sc_ptr; // { dg-error {comparison between distinct pointer types [^\n]*lacks a cast} }
263
264 // New and delete.
265
266 new svint8_t; // { dg-error {cannot allocate objects with SVE type 'svint8_t'} }
267 new svint8_t (); // { dg-error {cannot allocate objects with SVE type 'svint8_t'} }
268
269 new (global_sve_sc_ptr) svint8_t; // { dg-error {cannot allocate objects with SVE type 'svint8_t'} }
270 new (global_sve_sc_ptr) svint8_t (); // { dg-error {cannot allocate objects with SVE type 'svint8_t'} }
271
272 sve_sc1.~svint8_t(); // { dg-error {expected class-name before '\(' token} }
273 delete sve_sc_ptr; // { dg-error {cannot delete objects with SVE type '(svint8_t|__SVInt8_t)'} }
274 delete[] sve_sc_ptr; // { dg-error {cannot delete objects with SVE type 'svint8_t'} }
275
276 // Conditional expressions.
277
278 0 ? sve_sc1 : sve_sc1;
279 0 ? sve_sc1 : sve_sh1; // { dg-error {different types 'svint8_t' and 'svint16_t'} }
280 0 ? sve_sc1 : 0; // { dg-error {different types 'svint8_t' and 'int'} }
281 0 ? 0 : sve_sc1; // { dg-error {different types 'int' and 'svint8_t'} }
282 0 ? sve_sc1 : sve_sc1;
283 0 ? sve_sc_ptr : sve_sc_ptr;
284 0 ? sve_sc_ptr : gnu_sc_ptr; // { dg-error {conditional expression between distinct pointer types [^\n]*lacks a cast} }
285 0 ? gnu_sc_ptr : sve_sc_ptr; // { dg-error {conditional expression between distinct pointer types [^\n]*lacks a cast} }
286
287 // Function arguments.
288
289 ext_consume_sve_sc (sve_sc1);
290 ext_consume_sve_sc (sve_sh1); // { dg-error {cannot convert 'svint16_t' to 'svint8_t'} }
291 ext_consume_const_int_ref (sve_sc1); // { dg-error {invalid initialization of reference of type 'const int&' from expression of type 'svint8_t'} }
292 ext_consume_varargs (sve_sc1); // { dg-error {cannot convert 'svint8_t' to 'int'} }
293 ext_consume_varargs (1, sve_sc1);
294
295 // Function returns.
296
297 ext_produce_sve_sc ();
298 sve_sc1 = ext_produce_sve_sc ();
299 sve_sh1 = ext_produce_sve_sc (); // { dg-error {cannot convert 'svint8_t' to 'svint16_t' in assignment} }
300
301 // Auto
302
303 #if __cplusplus >= 201103L
304 auto auto_sve_sc1 = sve_sc1;
305 auto auto_sve_sc1_return = ext_produce_sve_sc ();
306 #endif
307
308 // Varargs processing.
309
310 __builtin_va_list valist;
311 __builtin_va_arg (valist, svint8_t);
312
313 // Other built-ins
314
315 __builtin_launder (sve_sc1); // { dg-error {'svint8_t' of argument to '__builtin_launder' is not a pointer to object type} }
316 __builtin_memcpy (&sve_sc1, &sve_sc2, 2);
317
318 // Lambdas
319
320 #if __cplusplus >= 201103L
321 [sve_sc1] () {}; // { dg-error {capture by copy of SVE type 'svint8_t'} "" { target c++11 } }
322 [=] () { &sve_sc1; }; // { dg-error {capture by copy of SVE type 'svint8_t'} "" { target c++11 } }
323 [&sve_sc1] () { sve_sc1 = sve_sc2; }; // { dg-error {'sve_sc2' is not captured} "" { target c++11 } }
324 [&sve_sc1, &sve_sc2] () { sve_sc1 = sve_sc2; };
325 [&] () { sve_sc1 = sve_sc2; };
326 [] () { return ext_produce_sve_sc (); } ();
327 #endif
328
329 // Exceptions
330
331 throw svint8_t (); // { dg-error {cannot throw or catch SVE type 'svint8_t'} }
332 try {} catch (svint8_t x) {} // { dg-error {cannot throw or catch SVE type 'svint8_t'} }
333 try {} catch (svint8_t &x) {} // { dg-error {cannot throw or catch SVE type 'svint8_t'} }
334 try {} catch (svint8_t *x) {}
335 #if __cplusplus < 201103L
336 thrower2 ();
337 #endif
338
339 sfinae_f1<svint8_t> (sve_sc1);
340
341 // Use in traits. Doesn't use static_assert so that tests work with
342 // earlier -std=s.
343
344 { typedef int f[__has_nothrow_assign (svint8_t) ? 1 : -1]; }
345 { typedef int f[__has_trivial_assign (svint8_t) ? 1 : -1]; }
346 { typedef int f[__has_nothrow_constructor (svint8_t) ? 1 : -1]; }
347 { typedef int f[__has_trivial_constructor (svint8_t) ? 1 : -1]; }
348 { typedef int f[__has_nothrow_copy (svint8_t) ? 1 : -1]; }
349 { typedef int f[__has_trivial_copy (svint8_t) ? 1 : -1]; }
350 { typedef int f[__has_trivial_destructor (svint8_t) ? 1 : -1]; }
351 { typedef int f[__has_unique_object_representations (svint8_t) ? 1 : -1]; }
352 { typedef int f[!__has_virtual_destructor (svint8_t) ? 1 : -1]; }
353 { typedef int f[!__is_abstract (svint8_t) ? 1 : -1]; }
354 { typedef int f[__is_aggregate (svint8_t) ? 1 : -1]; }
355 { typedef int f[!__is_base_of (svint8_t, svint8_t) ? 1 : -1]; }
356 { typedef int f[!__is_base_of (svint8_t, svint16_t) ? 1 : -1]; }
357 { typedef int f[!__is_class (svint8_t) ? 1 : -1]; }
358 { typedef int f[!__is_empty (svint8_t) ? 1 : -1]; }
359 { typedef int f[!__is_enum (svint8_t) ? 1 : -1]; }
360 { typedef int f[!__is_final (svint8_t) ? 1 : -1]; }
361 { typedef int f[__is_pod (svint8_t) ? 1 : -1]; }
362 { typedef int f[!__is_polymorphic (svint8_t) ? 1 : -1]; }
363 { typedef int f[__is_same_as (svint8_t, svint8_t) ? 1 : -1]; }
364 { typedef int f[!__is_same_as (svint8_t, int8x32_t) ? 1 : -1]; }
365 { typedef int f[!__is_same_as (int8x32_t, svint8_t) ? 1 : -1]; }
366 { typedef int f[__is_same_as (svint8_t *, svint8_t *) ? 1 : -1]; }
367 { typedef int f[!__is_same_as (svint8_t *, int8x32_t *) ? 1 : -1]; }
368 { typedef int f[!__is_same_as (int8x32_t *, svint8_t *) ? 1 : -1]; }
369 { typedef int f[!__is_same_as (svint8_t, int) ? 1 : -1]; }
370 { typedef int f[!__is_same_as (svint8_t, svint16_t) ? 1 : -1]; }
371 { typedef int f[__is_trivial (svint8_t) ? 1 : -1]; }
372 { typedef int f[!__is_union (svint8_t) ? 1 : -1]; }
373 { typedef int f[__is_trivially_copyable (svint8_t) ? 1 : -1]; }
374 /* The intention is that svint8_t should behave like int8x32_t here. If the behavior
375 for int8x32_t changes then the behavior for svint8_t should change in the same
376 way. */
377 { typedef int f[!__is_trivially_assignable (int8x32_t, int8x32_t) ? 1 : -1]; }
378 { typedef int f[!__is_trivially_assignable (svint8_t, svint8_t) ? 1 : -1]; }
379 { typedef int f[!__is_trivially_assignable (svint8_t, int8x32_t) ? 1 : -1]; }
380 { typedef int f[!__is_trivially_assignable (int8x32_t, svint8_t) ? 1 : -1]; }
381 { typedef int f[!__is_trivially_assignable (svint8_t, int) ? 1 : -1]; }
382 { typedef int f[!__is_trivially_assignable (svint8_t, svint16_t) ? 1 : -1]; }
383 { typedef int f[!__is_assignable (int8x32_t, int8x32_t) ? 1 : -1]; }
384 { typedef int f[!__is_assignable (svint8_t, svint8_t) ? 1 : -1]; }
385 { typedef int f[!__is_assignable (svint8_t, int8x32_t) ? 1 : -1]; }
386 { typedef int f[!__is_assignable (int8x32_t, svint8_t) ? 1 : -1]; }
387 { typedef int f[!__is_assignable (svint8_t, int) ? 1 : -1]; }
388 { typedef int f[!__is_assignable (svint8_t, svint16_t) ? 1 : -1]; }
389 { typedef int f[__is_trivially_constructible (svint8_t) ? 1 : -1]; }
390 { typedef int f[__is_trivially_constructible (int8x32_t, int8x32_t) ? 1 : -1]; }
391 { typedef int f[__is_trivially_constructible (svint8_t, svint8_t) ? 1 : -1]; }
392 { typedef int f[__is_trivially_constructible (svint8_t, int8x32_t) ? 1 : -1]; }
393 { typedef int f[__is_trivially_constructible (int8x32_t, svint8_t) ? 1 : -1]; }
394 { typedef int f[!__is_trivially_constructible (svint8_t, int) ? 1 : -1]; }
395 { typedef int f[!__is_trivially_constructible (svint8_t, svint16_t) ? 1 : -1]; }
396 { typedef int f[__is_constructible (svint8_t) ? 1 : -1]; }
397 { typedef int f[__is_constructible (int8x32_t, int8x32_t) ? 1 : -1]; }
398 { typedef int f[__is_constructible (svint8_t, svint8_t) ? 1 : -1]; }
399 { typedef int f[__is_constructible (svint8_t, int8x32_t) ? 1 : -1]; }
400 { typedef int f[__is_constructible (int8x32_t, svint8_t) ? 1 : -1]; }
401 { typedef int f[!__is_constructible (svint8_t, int) ? 1 : -1]; }
402 { typedef int f[!__is_constructible (svint8_t, svint16_t) ? 1 : -1]; }
403 }
404
405 // Function parameters in definitions.
406
407 void
408 unnamed_st1 (svint8_t)
409 {
410 }
411
412 void
413 named_st1 (svint8_t param1)
414 {
415 svint8_t sve_sc1 = param1;
416 }
417
418 // Function return values in definitions.
419
420 svint8_t
421 ret_st1 (svint8_t param)
422 {
423 return param;
424 }
425
426 svint8_t
427 bad_ret_st1 (svint16_t param)
428 {
429 return param; // { dg-error {cannot convert 'svint16_t' to 'svint8_t' in return} }
430 }
431
432 #if __cplusplus >= 201103L
433 template<typename T>
434 void
435 const_to_sve_sc (T i)
436 {
437 constexpr svint8_t a = (svint8_t) i;
438 }
439 #endif
440
441 template<typename T>
442 int
443 get_x (T *a)
444 {
445 return a->a; // { dg-error {request for member 'a' in '\* a', which is of non-class type} }
446 }
447 template int get_x<svint8_t>(svint8_t *);
448
449 #if __cplusplus < 201103L
450 void thrower3 () throw (svint8_t) {} // { dg-error {cannot throw or catch SVE type 'svint8_t'} "" { target c++98_only } }
451 #endif
452
453 // Using "auto" as a return type.
454
455 #if __cplusplus >= 201402L
456 auto auto_ret_sve_sc (svint8_t *ptr) { return *ptr; }
457 const auto &auto_ret_const_sve_sc_ref (svint8_t *ptr) { return *ptr; }
458 auto &auto_ret_sve_sc_ref (svint8_t *ptr) { return *ptr; }
459 auto &&auto_ret_sve_sc_rvalue_ref (svint8_t *ptr) { return *ptr; }
460 #endif