fixed_point_unknown_conversions.c 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. // RUN: %clang_cc1 -verify -ffixed-point %s
  2. void func() {
  3. _Bool b;
  4. char c;
  5. int i;
  6. float f;
  7. double d;
  8. double _Complex dc;
  9. int _Complex ic;
  10. struct S {
  11. int i;
  12. } s;
  13. enum E {
  14. A
  15. } e;
  16. int *ptr;
  17. typedef int int_t;
  18. int_t i2;
  19. _Accum accum;
  20. _Fract fract = accum; // ok
  21. _Accum *accum_ptr;
  22. accum = f; // expected-error{{conversion between fixed point and 'float' is not yet supported}}
  23. accum = d; // expected-error{{conversion between fixed point and 'double' is not yet supported}}
  24. accum = dc; // expected-error{{conversion between fixed point and '_Complex double' is not yet supported}}
  25. accum = ic; // expected-error{{conversion between fixed point and '_Complex int' is not yet supported}}
  26. accum = s; // expected-error{{assigning to '_Accum' from incompatible type 'struct S'}}
  27. accum = ptr; // expected-error{{assigning to '_Accum' from incompatible type 'int *'}}
  28. accum_ptr = ptr; // expected-warning{{incompatible pointer types assigning to '_Accum *' from 'int *'}}
  29. f = accum; // expected-error{{conversion between fixed point and 'float' is not yet supported}}
  30. d = accum; // expected-error{{conversion between fixed point and 'double' is not yet supported}}
  31. dc = accum; // expected-error{{conversion between fixed point and '_Complex double' is not yet supported}}
  32. ic = accum; // expected-error{{conversion between fixed point and '_Complex int' is not yet supported}}
  33. s = accum; // expected-error{{assigning to 'struct S' from incompatible type '_Accum'}}
  34. ptr = accum; // expected-error{{assigning to 'int *' from incompatible type '_Accum'}}
  35. ptr = accum_ptr; // expected-warning{{incompatible pointer types assigning to 'int *' from '_Accum *'}}
  36. }