Leonard Chan | f921d85 | 2018-06-04 16:07:52 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -verify -ffixed-point %s |
| 2 | |
| 3 | /* We do not yet support long long. No recommended bit widths are given for this |
| 4 | * size. */ |
| 5 | |
| 6 | long long _Accum longlong_accum; // expected-error{{'long long _Accum' is invalid}} |
| 7 | unsigned long long _Accum u_longlong_accum; // expected-error{{'long long _Accum' is invalid}} |
Leonard Chan | ab80f3c | 2018-06-14 14:53:51 +0000 | [diff] [blame] | 8 | long long _Fract longlong_fract; // expected-error{{'long long _Fract' is invalid}} |
| 9 | unsigned long long _Fract u_longlong_fract; // expected-error{{'long long _Fract' is invalid}} |
| 10 | |
| 11 | _Sat long long _Accum sat_longlong_accum; // expected-error{{'long long _Accum' is invalid}} |
| 12 | _Sat unsigned long long _Accum sat_u_longlong_accum; // expected-error{{'long long _Accum' is invalid}} |
| 13 | _Sat long long _Fract sat_longlong_fract; // expected-error{{'long long _Fract' is invalid}} |
| 14 | _Sat unsigned long long _Fract sat_u_longlong_fract; // expected-error{{'long long _Fract' is invalid}} |
| 15 | |
Leonard Chan | f921d85 | 2018-06-04 16:07:52 +0000 | [diff] [blame] | 16 | |
| 17 | /* Although _Complex types work with floating point numbers, the extension |
| 18 | * provides no info for complex fixed point types. */ |
| 19 | |
| 20 | _Complex signed short _Accum cmplx_s_short_accum; // expected-error{{'_Complex _Accum' is invalid}} |
| 21 | _Complex signed _Accum cmplx_s_accum; // expected-error{{'_Complex _Accum' is invalid}} |
| 22 | _Complex signed long _Accum cmplx_s_long_accum; // expected-error{{'_Complex _Accum' is invalid}} |
| 23 | _Complex unsigned short _Accum cmplx_u_short_accum; // expected-error{{'_Complex _Accum' is invalid}} |
| 24 | _Complex unsigned _Accum cmplx_u_accum; // expected-error{{'_Complex _Accum' is invalid}} |
| 25 | _Complex unsigned long _Accum cmplx_u_long_accum; // expected-error{{'_Complex _Accum' is invalid}} |
| 26 | _Complex short _Accum cmplx_s_short_accum; // expected-error{{'_Complex _Accum' is invalid}} |
| 27 | _Complex _Accum cmplx_s_accum; // expected-error{{'_Complex _Accum' is invalid}} |
| 28 | _Complex long _Accum cmplx_s_long_accum; // expected-error{{'_Complex _Accum' is invalid}} |
| 29 | |
Leonard Chan | ab80f3c | 2018-06-14 14:53:51 +0000 | [diff] [blame] | 30 | _Complex signed short _Fract cmplx_s_short_fract; // expected-error{{'_Complex _Fract' is invalid}} |
| 31 | _Complex signed _Fract cmplx_s_fract; // expected-error{{'_Complex _Fract' is invalid}} |
| 32 | _Complex signed long _Fract cmplx_s_long_fract; // expected-error{{'_Complex _Fract' is invalid}} |
| 33 | _Complex unsigned short _Fract cmplx_u_short_fract; // expected-error{{'_Complex _Fract' is invalid}} |
| 34 | _Complex unsigned _Fract cmplx_u_fract; // expected-error{{'_Complex _Fract' is invalid}} |
| 35 | _Complex unsigned long _Fract cmplx_u_long_fract; // expected-error{{'_Complex _Fract' is invalid}} |
| 36 | _Complex short _Fract cmplx_s_short_fract; // expected-error{{'_Complex _Fract' is invalid}} |
| 37 | _Complex _Fract cmplx_s_fract; // expected-error{{'_Complex _Fract' is invalid}} |
| 38 | _Complex long _Fract cmplx_s_long_fract; // expected-error{{'_Complex _Fract' is invalid}} |
| 39 | |
| 40 | _Complex _Sat signed short _Accum cmplx_sat_s_short_accum; // expected-error{{'_Complex _Accum' is invalid}} |
| 41 | _Complex _Sat signed _Accum cmplx_sat_s_accum; // expected-error{{'_Complex _Accum' is invalid}} |
| 42 | _Complex _Sat signed long _Accum cmplx_sat_s_long_accum; // expected-error{{'_Complex _Accum' is invalid}} |
| 43 | _Complex _Sat unsigned short _Accum cmplx_sat_u_short_accum; // expected-error{{'_Complex _Accum' is invalid}} |
| 44 | _Complex _Sat unsigned _Accum cmplx_sat_u_accum; // expected-error{{'_Complex _Accum' is invalid}} |
| 45 | _Complex _Sat unsigned long _Accum cmplx_sat_u_long_accum; // expected-error{{'_Complex _Accum' is invalid}} |
| 46 | _Complex _Sat short _Accum cmplx_sat_s_short_accum; // expected-error{{'_Complex _Accum' is invalid}} |
| 47 | _Complex _Sat _Accum cmplx_sat_s_accum; // expected-error{{'_Complex _Accum' is invalid}} |
| 48 | _Complex _Sat long _Accum cmplx_sat_s_long_accum; // expected-error{{'_Complex _Accum' is invalid}} |
| 49 | |
| 50 | _Complex signed short _Fract cmplx_sat_s_short_fract; // expected-error{{'_Complex _Fract' is invalid}} |
| 51 | _Complex signed _Fract cmplx_sat_s_fract; // expected-error{{'_Complex _Fract' is invalid}} |
| 52 | _Complex signed long _Fract cmplx_sat_s_long_fract; // expected-error{{'_Complex _Fract' is invalid}} |
| 53 | _Complex unsigned short _Fract cmplx_sat_u_short_fract; // expected-error{{'_Complex _Fract' is invalid}} |
| 54 | _Complex unsigned _Fract cmplx_sat_u_fract; // expected-error{{'_Complex _Fract' is invalid}} |
| 55 | _Complex unsigned long _Fract cmplx_sat_u_long_fract; // expected-error{{'_Complex _Fract' is invalid}} |
| 56 | _Complex short _Fract cmplx_sat_s_short_fract; // expected-error{{'_Complex _Fract' is invalid}} |
| 57 | _Complex _Fract cmplx_sat_s_fract; // expected-error{{'_Complex _Fract' is invalid}} |
| 58 | _Complex long _Fract cmplx_sat_s_long_fract; // expected-error{{'_Complex _Fract' is invalid}} |
| 59 | |
Leonard Chan | f921d85 | 2018-06-04 16:07:52 +0000 | [diff] [blame] | 60 | /* Bad combinations */ |
| 61 | float _Accum f_accum; // expected-error{{cannot combine with previous 'float' declaration specifier}} |
| 62 | double _Accum d_accum; // expected-error{{cannot combine with previous 'double' declaration specifier}} |
| 63 | _Bool _Accum b_accum; // expected-error{{cannot combine with previous '_Bool' declaration specifier}} |
| 64 | char _Accum c_accum; // expected-error{{cannot combine with previous 'char' declaration specifier}} |
| 65 | int _Accum i_accum; // expected-error{{cannot combine with previous 'int' declaration specifier}} |
Leonard Chan | ab80f3c | 2018-06-14 14:53:51 +0000 | [diff] [blame] | 66 | |
| 67 | float _Fract f_fract; // expected-error{{cannot combine with previous 'float' declaration specifier}} |
| 68 | double _Fract d_fract; // expected-error{{cannot combine with previous 'double' declaration specifier}} |
| 69 | _Bool _Fract b_fract; // expected-error{{cannot combine with previous '_Bool' declaration specifier}} |
| 70 | char _Fract c_fract; // expected-error{{cannot combine with previous 'char' declaration specifier}} |
| 71 | int _Fract i_fract; // expected-error{{cannot combine with previous 'int' declaration specifier}} |
| 72 | |
| 73 | /* Bad saturated combinations */ |
| 74 | _Sat float f; // expected-error{{'_Sat' specifier is only valid on '_Fract' or '_Accum', not 'float'}} |
| 75 | _Sat double d; // expected-error{{'_Sat' specifier is only valid on '_Fract' or '_Accum', not 'double'}} |
| 76 | _Sat _Bool b; // expected-error{{'_Sat' specifier is only valid on '_Fract' or '_Accum', not '_Bool'}} |
| 77 | _Sat char c; // expected-error{{'_Sat' specifier is only valid on '_Fract' or '_Accum', not 'char'}} |
| 78 | _Sat int i; // expected-error{{'_Sat' specifier is only valid on '_Fract' or '_Accum', not 'int'}} |
| 79 | _Sat _Sat _Fract fract; // expected-warning{{duplicate '_Sat' declaration specifier}} |
| 80 | |
| 81 | /* Do not allow typedef to be used with typedef'd types */ |
| 82 | typedef short _Fract shortfract_t; |
| 83 | typedef short _Accum shortaccum_t; |
| 84 | typedef _Fract fract_t; |
| 85 | typedef _Accum accum_t; |
| 86 | typedef long _Fract longfract_t; |
| 87 | typedef long _Accum longaccum_t; |
| 88 | _Sat shortfract_t td_sat_short_fract; // expected-error{{'_Sat' specifier is only valid on '_Fract' or '_Accum', not 'type-name'}} |
| 89 | _Sat shortaccum_t td_sat_short_accum; // expected-error{{'_Sat' specifier is only valid on '_Fract' or '_Accum', not 'type-name'}} |
| 90 | _Sat fract_t td_sat_fract; // expected-error{{'_Sat' specifier is only valid on '_Fract' or '_Accum', not 'type-name'}} |
| 91 | _Sat accum_t td_sat_accum; // expected-error{{'_Sat' specifier is only valid on '_Fract' or '_Accum', not 'type-name'}} |
| 92 | _Sat longfract_t td_sat_long_fract; // expected-error{{'_Sat' specifier is only valid on '_Fract' or '_Accum', not 'type-name'}} |
| 93 | _Sat longaccum_t td_sat_long_accum; // expected-error{{'_Sat' specifier is only valid on '_Fract' or '_Accum', not 'type-name'}} |