1 // RUN: %clang_cc1 %s -triple aarch64-none-linux-gnu -target-feature +sve -fsyntax-only -verify
2 
3 // This test is invalid under the sizeless type extension and is a stop-gap
4 // until that extension is added.  The test makes sure that sizeof and
5 // alignof queries are handled without assertion failures, since at
6 // present there is nothing to prevent such queries being made.
7 //
8 // Under this scheme, sizeof returns 0 for all built-in sizeless types.
9 // This is compatible with correct usage but it relies on the user being
10 // careful to avoid constructs that depend directly or indirectly on the
11 // value of sizeof.  (The sizeless type extension avoids this by treating
12 // such constructs as an error.)
13 
14 // expected-no-diagnostics
15 
f()16 void f() {
17   int size_s8[sizeof(__SVInt8_t) == 0 ? 1 : -1];
18   int align_s8[__alignof__(__SVInt8_t) == 16 ? 1 : -1];
19 
20   int size_s16[sizeof(__SVInt16_t) == 0 ? 1 : -1];
21   int align_s16[__alignof__(__SVInt16_t) == 16 ? 1 : -1];
22 
23   int size_s32[sizeof(__SVInt32_t) == 0 ? 1 : -1];
24   int align_s32[__alignof__(__SVInt32_t) == 16 ? 1 : -1];
25 
26   int size_s64[sizeof(__SVInt64_t) == 0 ? 1 : -1];
27   int align_s64[__alignof__(__SVInt64_t) == 16 ? 1 : -1];
28 
29   int size_u8[sizeof(__SVUint8_t) == 0 ? 1 : -1];
30   int align_u8[__alignof__(__SVUint8_t) == 16 ? 1 : -1];
31 
32   int size_u16[sizeof(__SVUint16_t) == 0 ? 1 : -1];
33   int align_u16[__alignof__(__SVUint16_t) == 16 ? 1 : -1];
34 
35   int size_u32[sizeof(__SVUint32_t) == 0 ? 1 : -1];
36   int align_u32[__alignof__(__SVUint32_t) == 16 ? 1 : -1];
37 
38   int size_u64[sizeof(__SVUint64_t) == 0 ? 1 : -1];
39   int align_u64[__alignof__(__SVUint64_t) == 16 ? 1 : -1];
40 
41   int size_f16[sizeof(__SVFloat16_t) == 0 ? 1 : -1];
42   int align_f16[__alignof__(__SVFloat16_t) == 16 ? 1 : -1];
43 
44   int size_f32[sizeof(__SVFloat32_t) == 0 ? 1 : -1];
45   int align_f32[__alignof__(__SVFloat32_t) == 16 ? 1 : -1];
46 
47   int size_f64[sizeof(__SVFloat64_t) == 0 ? 1 : -1];
48   int align_f64[__alignof__(__SVFloat64_t) == 16 ? 1 : -1];
49 
50   int size_b8[sizeof(__SVBool_t) == 0 ? 1 : -1];
51   int align_b8[__alignof__(__SVBool_t) == 2 ? 1 : -1];
52 }
53