xref: /llvm-project/clang/test/Frontend/fixed_point_errors.cpp (revision a3a7d6318027bb86e6614c022e77e0bd81aef6dc)
1 // RUN: %clang_cc1 -x c++ %s -verify -DWITHOUT_FIXED_POINT
2 // RUN: %clang_cc1 -x c++ %s -verify -ffixed-point
3 
4 #ifdef WITHOUT_FIXED_POINT
5 _Accum accum;                           // expected-error{{compile with '-ffixed-point' to enable fixed point types}}
6                                         // expected-error@-1{{a type specifier is required for all declarations}}
7 _Fract fract;                           // expected-error{{compile with '-ffixed-point' to enable fixed point types}}
8                                         // expected-error@-1{{a type specifier is required for all declarations}}
9 _Sat _Accum sat_accum;                  // expected-error 2{{compile with '-ffixed-point' to enable fixed point types}}
10                                         // expected-error@-1{{a type specifier is required for all declarations}}
11 #endif
12 
13 int accum_int = 10k;     // expected-error{{invalid suffix 'k' on integer constant}}
14 int fract_int = 10r;     // expected-error{{invalid suffix 'r' on integer constant}}
15 #ifdef WITHOUT_FIXED_POINT
16 float accum_flt = 0.0k;  // expected-error{{invalid suffix 'k' on floating constant}}
17 float fract_flt = 0.0r;  // expected-error{{invalid suffix 'r' on floating constant}}
18 #endif
19