blob: e7522213f98d61ced145c67f4c51505df8b1fa43 [file] [log] [blame]
Leonard Chanf921d852018-06-04 16:07:52 +00001// RUN: %clang_cc1 -x c -verify %s
2
3// Primary fixed point types
4signed short _Accum s_short_accum; // expected-error{{compile with '-ffixed-point' to enable fixed point types}}
5signed _Accum s_accum; // expected-error{{compile with '-ffixed-point' to enable fixed point types}}
6signed long _Accum s_long_accum; // expected-error{{compile with '-ffixed-point' to enable fixed point types}}
7unsigned short _Accum u_short_accum; // expected-error{{compile with '-ffixed-point' to enable fixed point types}}
8unsigned _Accum u_accum; // expected-error{{compile with '-ffixed-point' to enable fixed point types}}
9unsigned long _Accum u_long_accum; // expected-error{{compile with '-ffixed-point' to enable fixed point types}}
10
11// Aliased fixed point types
12short _Accum short_accum; // expected-error{{compile with '-ffixed-point' to enable fixed point types}}
13_Accum accum; // expected-error{{compile with '-ffixed-point' to enable fixed point types}}
14 // expected-warning@-1{{type specifier missing, defaults to 'int'}}
15long _Accum long_accum; // expected-error{{compile with '-ffixed-point' to enable fixed point types}}
Leonard Chane5597ad2018-07-17 14:58:49 +000016
17// Cannot use fixed point suffixes
18int accum_int = 10k; // expected-error{{invalid suffix 'k' on integer constant}}
19int fract_int = 10r; // expected-error{{invalid suffix 'r' on integer constant}}
20float accum_flt = 10.0k; // expected-error{{invalid suffix 'k' on floating constant}}
21float fract_flt = 10.0r; // expected-error{{invalid suffix 'r' on floating constant}}