1 // { dg-do compile { target aarch64*-*-* } }
2 // { dg-options "-Wclass-memaccess" }
3 
4 #pragma GCC target "+sve"
5 
6 typedef __SIZE_TYPE__ size_t;
new(size_t,void * __p)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 // Main tests for statements and expressions.
128 
129 void
statements(int n)130 statements (int n)
131 {
132   // Local declarations.
133 
134   svint8_t sve_sc1, sve_sc2;
135   volatile svint8_t volatile_sve_sc1;
136   int8x32_t gnu_sc1;
137   svint16_t sve_sh1;
138 
139   // Layout queries.
140 
141   sizeof (svint8_t); // { dg-error {SVE type 'svint8_t' does not have a fixed size} }
142   sizeof (sve_sc1); // { dg-error {SVE type 'svint8_t' does not have a fixed size} }
143   sizeof (ext_produce_sve_sc ()); // { dg-error {SVE type 'svint8_t' does not have a fixed size} }
144   __alignof (svint8_t); // { dg-error {SVE type 'svint8_t' does not have a defined alignment} }
145   __alignof (sve_sc1); // { dg-error {SVE type 'svint8_t' does not have a defined alignment} }
146   __alignof (ext_produce_sve_sc ()); // { dg-error {SVE type 'svint8_t' does not have a defined alignment} }
147 
148 #if __cplusplus >= 201103L
149   array<svint8_t> foo = {}; // { dg-message {required from here} "" { target c++11 } }
150 #endif
151 
152   // Initialization.
153 
154   int init_int1 = sve_sc1; // { dg-error {cannot convert 'svint8_t' to 'int' in initialization} }
155   int init_int2 = { sve_sc1 }; // { dg-error {cannot convert 'svint8_t' to 'int' in initialization} }
156 
157   svint8_t init_sve_sc1 (sve_sc1);
158   svint8_t init_sve_sc2 (sve_sh1); // { dg-error {cannot convert 'svint16_t' to 'svint8_t'} }
159   svint8_t init_sve_sc3 = sve_sc1;
160   svint8_t init_sve_sc4 = sve_sh1; // { dg-error {cannot convert 'svint16_t' to 'svint8_t'} }
161   svint8_t init_sve_sc5 = {};
162   svint8_t init_sve_sc6 = { sve_sc1 };
163   svint8_t init_sve_sc7 = { sve_sh1 }; // { dg-error {cannot convert 'svint16_t' to 'svint8_t'} }
164 
165   // Constructor calls.
166 
167   (0, svint8_t ());
168 
169   // Lvalue reference binding
170 
171   svint8_t &lvalue_ref_sve_sc1 = sve_sc1;
172   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'} }
173   svint8_t &lvalue_ref_sve_sc3 = sve_sh1; // { dg-error {invalid initialization of reference of type 'svint8_t&' from expression of type 'svint16_t'} }
174 
175   const svint8_t &const_lvalue_ref_sve_sc1 = sve_sc1;
176   const svint8_t &const_lvalue_ref_sve_sc2 = ext_produce_sve_sc ();
177   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'} }
178 
179   // Compound literals.
180 
181   (int) { sve_sc1 }; // { dg-error {cannot convert 'svint8_t' to 'int' in initialization} }
182 
183   // Arrays.
184 
185   svint8_t array[2]; // { dg-error {array elements cannot have SVE type 'svint8_t'} }
186   svint8_t zero_length_array[0]; // { dg-error {array elements cannot have SVE type 'svint8_t'} }
187   svint8_t empty_init_array[] = {}; // { dg-error {array elements cannot have SVE type 'svint8_t'} }
188 
189   // Assignment.
190 
191   n = sve_sc1; // { dg-error {cannot convert 'svint8_t' to 'int' in assignment} }
192 
193   sve_sc1 = 0; // { dg-error {cannot convert 'int' to 'svint8_t' in assignment} }
194   sve_sc1 = sve_sc1;
195   sve_sc1 = gnu_sc1; // { dg-error {cannot convert 'int8x32_t'[^\n]* to 'svint8_t' in assignment} }
196   gnu_sc1 = sve_sc1; // { dg-error {cannot convert 'svint8_t' to 'int8x32_t'} }
197   sve_sc1 = sve_sh1; // { dg-error {cannot convert 'svint16_t' to 'svint8_t'} }
198 
199   // Casting.
200 
201   (void) sve_sc1;
202   (void) volatile_sve_sc1;
203   (void) *&volatile_sve_sc1;
204 
205   // Addressing and dereferencing.
206 
207   svint8_t *sve_sc_ptr = &sve_sc1;
208   int8x32_t *gnu_sc_ptr = &gnu_sc1;
209   sve_sc_ptr = (svint16_t *) 0; // { dg-error {cannot convert 'svint16_t\*' to 'svint8_t\*' in assignment} }
210 
211   // Pointer assignment.
212 
213   gnu_sc_ptr = sve_sc_ptr; // { dg-error {cannot convert 'svint8_t\*' to 'int8x32_t\*'} }
214   sve_sc_ptr = gnu_sc_ptr; // { dg-error {cannot convert 'int8x32_t\*'[^\n]* to 'svint8_t\*'} }
215 
216   // Pointer arithmetic.
217 
218   ++sve_sc_ptr; // { dg-error {arithmetic on pointer to SVE type 'svint8_t'} }
219   --sve_sc_ptr; // { dg-error {arithmetic on pointer to SVE type 'svint8_t'} }
220   sve_sc_ptr++; // { dg-error {arithmetic on pointer to SVE type 'svint8_t'} }
221   sve_sc_ptr--; // { dg-error {arithmetic on pointer to SVE type 'svint8_t'} }
222   sve_sc_ptr += 0; // { dg-error {arithmetic on pointer to SVE type 'svint8_t'} }
223   sve_sc_ptr += 1; // { dg-error {arithmetic on pointer to SVE type 'svint8_t'} }
224   sve_sc_ptr -= 0; // { dg-error {arithmetic on pointer to SVE type 'svint8_t'} }
225   sve_sc_ptr -= 1; // { dg-error {arithmetic on pointer to SVE type 'svint8_t'} }
226   sve_sc_ptr - sve_sc_ptr; // { dg-error {arithmetic on pointer to SVE type 'svint8_t'} }
227   gnu_sc_ptr - sve_sc_ptr; // { dg-error {invalid operands of types 'int8x32_t\*'[^\n]* and 'svint8_t\*' to binary 'operator-'} }
228   sve_sc_ptr - gnu_sc_ptr; // { dg-error {invalid operands of types 'svint8_t\*' and 'int8x32_t\*'[^\n]* to binary 'operator-'} }
229   sve_sc1 = sve_sc_ptr[0]; // { dg-error {arithmetic on pointer to SVE type 'svint8_t'} }
230   sve_sc1 = sve_sc_ptr[1]; // { dg-error {arithmetic on pointer to SVE type 'svint8_t'} }
231 
232   // Pointer comparison.
233 
234   sve_sc_ptr == &sve_sc1;
235   sve_sc_ptr != &sve_sc1;
236   sve_sc_ptr < &sve_sc1;
237   sve_sc_ptr <= &sve_sc1;
238   sve_sc_ptr > &sve_sc1;
239   sve_sc_ptr >= &sve_sc1;
240   gnu_sc_ptr == sve_sc_ptr; // { dg-error {comparison between distinct pointer types [^\n]*lacks a cast} }
241   gnu_sc_ptr != sve_sc_ptr; // { dg-error {comparison between distinct pointer types [^\n]*lacks a cast} }
242   gnu_sc_ptr < sve_sc_ptr; // { dg-error {comparison between distinct pointer types [^\n]*lacks a cast} }
243   gnu_sc_ptr <= sve_sc_ptr; // { dg-error {comparison between distinct pointer types [^\n]*lacks a cast} }
244   gnu_sc_ptr > sve_sc_ptr; // { dg-error {comparison between distinct pointer types [^\n]*lacks a cast} }
245   gnu_sc_ptr >= sve_sc_ptr; // { dg-error {comparison between distinct pointer types [^\n]*lacks a cast} }
246   sve_sc_ptr == gnu_sc_ptr; // { dg-error {comparison between distinct pointer types [^\n]*lacks a cast} }
247   sve_sc_ptr != gnu_sc_ptr; // { dg-error {comparison between distinct pointer types [^\n]*lacks a cast} }
248   sve_sc_ptr < gnu_sc_ptr; // { dg-error {comparison between distinct pointer types [^\n]*lacks a cast} }
249   sve_sc_ptr <= gnu_sc_ptr; // { dg-error {comparison between distinct pointer types [^\n]*lacks a cast} }
250   sve_sc_ptr > gnu_sc_ptr; // { dg-error {comparison between distinct pointer types [^\n]*lacks a cast} }
251   sve_sc_ptr >= gnu_sc_ptr; // { dg-error {comparison between distinct pointer types [^\n]*lacks a cast} }
252 
253   // New and delete.
254 
255   new svint8_t; // { dg-error {cannot allocate objects with SVE type 'svint8_t'} }
256   new svint8_t (); // { dg-error {cannot allocate objects with SVE type 'svint8_t'} }
257 
258   new (global_sve_sc_ptr) svint8_t; // { dg-error {cannot allocate objects with SVE type 'svint8_t'} }
259   new (global_sve_sc_ptr) svint8_t (); // { dg-error {cannot allocate objects with SVE type 'svint8_t'} }
260 
261   sve_sc1.~svint8_t(); // { dg-error {expected class-name before '\(' token} }
262   delete sve_sc_ptr; // { dg-error {cannot delete objects with SVE type '(svint8_t|__SVInt8_t)'} }
263   delete[] sve_sc_ptr; // { dg-error {cannot delete objects with SVE type 'svint8_t'} }
264 
265   // Conditional expressions.
266 
267   0 ? sve_sc1 : sve_sc1;
268   0 ? sve_sc1 : sve_sh1; // { dg-error {different types 'svint8_t' and 'svint16_t'} }
269   0 ? sve_sc1 : 0; // { dg-error {different types 'svint8_t' and 'int'} }
270   0 ? 0 : sve_sc1; // { dg-error {different types 'int' and 'svint8_t'} }
271   0 ? sve_sc1 : sve_sc1;
272   0 ? sve_sc_ptr : sve_sc_ptr;
273   0 ? sve_sc_ptr : gnu_sc_ptr; // { dg-error {conditional expression between distinct pointer types [^\n]*lacks a cast} }
274   0 ? gnu_sc_ptr : sve_sc_ptr; // { dg-error {conditional expression between distinct pointer types [^\n]*lacks a cast} }
275 
276   // Function arguments.
277 
278   ext_consume_sve_sc (sve_sc1);
279   ext_consume_sve_sc (sve_sh1); // { dg-error {cannot convert 'svint16_t' to 'svint8_t'} }
280   ext_consume_const_int_ref (sve_sc1); // { dg-error {invalid initialization of reference of type 'const int&' from expression of type 'svint8_t'} }
281   ext_consume_varargs (sve_sc1); // { dg-error {cannot convert 'svint8_t' to 'int'} }
282   ext_consume_varargs (1, sve_sc1);
283 
284   // Function returns.
285 
286   ext_produce_sve_sc ();
287   sve_sc1 = ext_produce_sve_sc ();
288   sve_sh1 = ext_produce_sve_sc (); // { dg-error {cannot convert 'svint8_t' to 'svint16_t' in assignment} }
289 
290   // Auto
291 
292 #if __cplusplus >= 201103L
293   auto auto_sve_sc1 = sve_sc1;
294   auto auto_sve_sc1_return = ext_produce_sve_sc ();
295 #endif
296 
297   // Varargs processing.
298 
299   __builtin_va_list valist;
300   __builtin_va_arg (valist, svint8_t);
301 
302   // Other built-ins
303 
304   __builtin_launder (sve_sc1); // { dg-error {non-pointer argument to '__builtin_launder'} }
305   __builtin_memcpy (&sve_sc1, &sve_sc2, 2);
306 
307   // Lambdas
308 
309 #if __cplusplus >= 201103L
310   [sve_sc1] () {}; // { dg-error {capture by copy of SVE type 'svint8_t'} "" { target c++11 } }
311   [=] () { &sve_sc1; }; // { dg-error {capture by copy of SVE type 'svint8_t'} "" { target c++11 } }
312   [&sve_sc1] () { sve_sc1 = sve_sc2; }; // { dg-error {'sve_sc2' is not captured} "" { target c++11 } }
313   [&sve_sc1, &sve_sc2] () { sve_sc1 = sve_sc2; };
314   [&] () { sve_sc1 = sve_sc2; };
315   [] () { return ext_produce_sve_sc (); } ();
316 #endif
317 
318   // Exceptions
319 
320   throw svint8_t (); // { dg-error {cannot throw or catch SVE type 'svint8_t'} }
321   try {} catch (svint8_t x) {} // { dg-error {cannot throw or catch SVE type 'svint8_t'} }
322   try {} catch (svint8_t &x) {} // { dg-error {cannot throw or catch SVE type 'svint8_t'} }
323   try {} catch (svint8_t *x) {}
324 #if __cplusplus < 201103L
325   thrower2 ();
326 #endif
327 
328   sfinae_f1<svint8_t> (sve_sc1);
329 
330   // Use in traits.  Doesn't use static_assert so that tests work with
331   // earlier -std=s.
332 
333   { typedef int f[__has_nothrow_assign (svint8_t) ? 1 : -1]; }
334   { typedef int f[__has_trivial_assign (svint8_t) ? 1 : -1]; }
335   { typedef int f[__has_nothrow_constructor (svint8_t) ? 1 : -1]; }
336   { typedef int f[__has_trivial_constructor (svint8_t) ? 1 : -1]; }
337   { typedef int f[__has_nothrow_copy (svint8_t) ? 1 : -1]; }
338   { typedef int f[__has_trivial_copy (svint8_t) ? 1 : -1]; }
339   { typedef int f[__has_trivial_destructor (svint8_t) ? 1 : -1]; }
340   { typedef int f[__has_unique_object_representations (svint8_t) ? 1 : -1]; }
341   { typedef int f[!__has_virtual_destructor (svint8_t) ? 1 : -1]; }
342   { typedef int f[!__is_abstract (svint8_t) ? 1 : -1]; }
343   { typedef int f[!__is_aggregate (svint8_t) ? 1 : -1]; }
344   { typedef int f[!__is_base_of (svint8_t, svint8_t) ? 1 : -1]; }
345   { typedef int f[!__is_base_of (svint8_t, svint16_t) ? 1 : -1]; }
346   { typedef int f[!__is_class (svint8_t) ? 1 : -1]; }
347   { typedef int f[!__is_empty (svint8_t) ? 1 : -1]; }
348   { typedef int f[!__is_enum (svint8_t) ? 1 : -1]; }
349   { typedef int f[!__is_final (svint8_t) ? 1 : -1]; }
350   { typedef int f[__is_pod (svint8_t) ? 1 : -1]; }
351   { typedef int f[!__is_polymorphic (svint8_t) ? 1 : -1]; }
352   { typedef int f[__is_same_as (svint8_t, svint8_t) ? 1 : -1]; }
353   { typedef int f[!__is_same_as (svint8_t, int8x32_t) ? 1 : -1]; }
354   { typedef int f[!__is_same_as (int8x32_t, svint8_t) ? 1 : -1]; }
355   { typedef int f[__is_same_as (svint8_t *, svint8_t *) ? 1 : -1]; }
356   { typedef int f[!__is_same_as (svint8_t *, int8x32_t *) ? 1 : -1]; }
357   { typedef int f[!__is_same_as (int8x32_t *, svint8_t *) ? 1 : -1]; }
358   { typedef int f[!__is_same_as (svint8_t, int) ? 1 : -1]; }
359   { typedef int f[!__is_same_as (svint8_t, svint16_t) ? 1 : -1]; }
360   { typedef int f[__is_trivial (svint8_t) ? 1 : -1]; }
361   { typedef int f[!__is_union (svint8_t) ? 1 : -1]; }
362   { typedef int f[__is_trivially_copyable (svint8_t) ? 1 : -1]; }
363   /* The intention is that svint8_t should behave like int8x32_t here.  If the behavior
364      for int8x32_t changes then the behavior for svint8_t should change in the same
365      way.  */
366   { typedef int f[!__is_trivially_assignable (int8x32_t, int8x32_t) ? 1 : -1]; }
367   { typedef int f[!__is_trivially_assignable (svint8_t, svint8_t) ? 1 : -1]; }
368   { typedef int f[!__is_trivially_assignable (svint8_t, int8x32_t) ? 1 : -1]; }
369   { typedef int f[!__is_trivially_assignable (int8x32_t, svint8_t) ? 1 : -1]; }
370   { typedef int f[!__is_trivially_assignable (svint8_t, int) ? 1 : -1]; }
371   { typedef int f[!__is_trivially_assignable (svint8_t, svint16_t) ? 1 : -1]; }
372   { typedef int f[!__is_assignable (int8x32_t, int8x32_t) ? 1 : -1]; }
373   { typedef int f[!__is_assignable (svint8_t, svint8_t) ? 1 : -1]; }
374   { typedef int f[!__is_assignable (svint8_t, int8x32_t) ? 1 : -1]; }
375   { typedef int f[!__is_assignable (int8x32_t, svint8_t) ? 1 : -1]; }
376   { typedef int f[!__is_assignable (svint8_t, int) ? 1 : -1]; }
377   { typedef int f[!__is_assignable (svint8_t, svint16_t) ? 1 : -1]; }
378   { typedef int f[__is_trivially_constructible (svint8_t) ? 1 : -1]; }
379   { typedef int f[__is_trivially_constructible (int8x32_t, int8x32_t) ? 1 : -1]; }
380   { typedef int f[__is_trivially_constructible (svint8_t, svint8_t) ? 1 : -1]; }
381   { typedef int f[!__is_trivially_constructible (svint8_t, int8x32_t) ? 1 : -1]; }
382   { typedef int f[!__is_trivially_constructible (int8x32_t, svint8_t) ? 1 : -1]; }
383   { typedef int f[!__is_trivially_constructible (svint8_t, int) ? 1 : -1]; }
384   { typedef int f[!__is_trivially_constructible (svint8_t, svint16_t) ? 1 : -1]; }
385   { typedef int f[__is_constructible (svint8_t) ? 1 : -1]; }
386   { typedef int f[__is_constructible (int8x32_t, int8x32_t) ? 1 : -1]; }
387   { typedef int f[__is_constructible (svint8_t, svint8_t) ? 1 : -1]; }
388   { typedef int f[!__is_constructible (svint8_t, int8x32_t) ? 1 : -1]; }
389   { typedef int f[!__is_constructible (int8x32_t, svint8_t) ? 1 : -1]; }
390   { typedef int f[!__is_constructible (svint8_t, int) ? 1 : -1]; }
391   { typedef int f[!__is_constructible (svint8_t, svint16_t) ? 1 : -1]; }
392 }
393 
394 // Function parameters in definitions.
395 
396 void
unnamed_st1(svint8_t)397 unnamed_st1 (svint8_t)
398 {
399 }
400 
401 void
named_st1(svint8_t param1)402 named_st1 (svint8_t param1)
403 {
404   svint8_t sve_sc1 = param1;
405 }
406 
407 // Function return values in definitions.
408 
409 svint8_t
ret_st1(svint8_t param)410 ret_st1 (svint8_t param)
411 {
412   return param;
413 }
414 
415 svint8_t
bad_ret_st1(svint16_t param)416 bad_ret_st1 (svint16_t param)
417 {
418   return param; // { dg-error {cannot convert 'svint16_t' to 'svint8_t' in return} }
419 }
420 
421 #if __cplusplus >= 201103L
422 template<typename T>
423 void
const_to_sve_sc(T i)424 const_to_sve_sc (T i)
425 {
426   constexpr svint8_t a = (svint8_t) i;
427 }
428 #endif
429 
430 template<typename T>
431 int
get_x(T * a)432 get_x (T *a)
433 {
434   return a->a; // { dg-error {request for member 'a' in '\* a', which is of non-class type} }
435 }
436 template int get_x<svint8_t>(svint8_t *);
437 
438 #if __cplusplus < 201103L
thrower3()439 void thrower3 () throw (svint8_t) {} // { dg-error {cannot throw or catch SVE type 'svint8_t'} "" { target c++98_only } }
440 #endif
441 
442 // Using "auto" as a return type.
443 
444 #if __cplusplus >= 201402L
auto_ret_sve_sc(svint8_t * ptr)445 auto auto_ret_sve_sc (svint8_t *ptr) { return *ptr; }
auto_ret_const_sve_sc_ref(svint8_t * ptr)446 const auto &auto_ret_const_sve_sc_ref (svint8_t *ptr) { return *ptr; }
auto_ret_sve_sc_ref(svint8_t * ptr)447 auto &auto_ret_sve_sc_ref (svint8_t *ptr) { return *ptr; }
auto_ret_sve_sc_rvalue_ref(svint8_t * ptr)448 auto &&auto_ret_sve_sc_rvalue_ref (svint8_t *ptr) { return *ptr; }
449 #endif
450