| 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{{unknown type name '_Accum'}} |
| 6 |
_Fract fract; // expected-error{{unknown type name '_Fract'}} |
| 7 |
_Sat _Accum sat_accum; // expected-error{{unknown type name '_Sat'}} |
| 8 |
// expected-error@-1{{expected ';' after top level declarator}} |
| 9 |
#endif |
| 10 |
|
| 11 |
int accum_int = 10k; // expected-error{{invalid suffix 'k' on integer constant}} |
| 12 |
int fract_int = 10r; // expected-error{{invalid suffix 'r' on integer constant}} |
| 13 |
#ifdef WITHOUT_FIXED_POINT |
| 14 |
float accum_flt = 0.0k; // expected-error{{invalid suffix 'k' on floating constant}} |
| 15 |
float fract_flt = 0.0r; // expected-error{{invalid suffix 'r' on floating constant}} |
| 16 |
#endif |
| 17 |
|
| 18 |
#ifndef WITHOUT_FIXED_POINT |
| 19 |
const char *c = 10.0k; // expected-error{{cannot initialize a variable of type 'const char *' with an rvalue of type '_Accum'}} |
| 20 |
#endif |