xref: /llvm-project/clang/test/Frontend/fixed_point_unknown_conversions.c (revision 99bda375a14e4c3b7d0adbc65293879899875fa6)
1 // RUN: %clang_cc1 -verify -ffixed-point %s
2 
3 void func() {
4   _Bool b;
5   char c;
6   int i;
7   float f;
8   double d;
9   double _Complex dc;
10   int _Complex ic;
11   struct S {
12     int i;
13   } s;
14   enum E {
15     A
16   } e;
17   int *ptr;
18   typedef int int_t;
19   int_t i2;
20 
21   _Accum accum;
22   _Fract fract = accum; // ok
23   _Accum *accum_ptr;
24 
25   accum = b;       // expected-error{{conversion between fixed point and '_Bool' is not yet supported}}
26   accum = i;       // expected-error{{conversion between fixed point and 'int' is not yet supported}}
27   accum = i;       // expected-error{{conversion between fixed point and 'int' is not yet supported}}
28   accum = f;       // expected-error{{conversion between fixed point and 'float' is not yet supported}}
29   accum = d;       // expected-error{{conversion between fixed point and 'double' is not yet supported}}
30   accum = dc;      // expected-error{{conversion between fixed point and '_Complex double' is not yet supported}}
31   accum = ic;      // expected-error{{conversion between fixed point and '_Complex int' is not yet supported}}
32   accum = s;       // expected-error{{assigning to '_Accum' from incompatible type 'struct S'}}
33   accum = e;       // expected-error{{conversion between fixed point and 'enum E' is not yet supported}}
34   accum = ptr;     // expected-error{{assigning to '_Accum' from incompatible type 'int *'}}
35   accum_ptr = ptr; // expected-warning{{incompatible pointer types assigning to '_Accum *' from 'int *'}}
36   accum = i2;      // expected-error{{conversion between fixed point and 'int_t' (aka 'int') is not yet supported}}
37 
38   b = accum;       // expected-error{{conversion between fixed point and '_Bool' is not yet supported}}
39   c = accum;       // expected-error{{conversion between fixed point and 'char' is not yet supported}}
40   i = accum;       // expected-error{{conversion between fixed point and 'int' is not yet supported}}
41   f = accum;       // expected-error{{conversion between fixed point and 'float' is not yet supported}}
42   d = accum;       // expected-error{{conversion between fixed point and 'double' is not yet supported}}
43   dc = accum;      // expected-error{{conversion between fixed point and '_Complex double' is not yet supported}}
44   ic = accum;      // expected-error{{conversion between fixed point and '_Complex int' is not yet supported}}
45   s = accum;       // expected-error{{assigning to 'struct S' from incompatible type '_Accum'}}
46   e = accum;       // expected-error{{conversion between fixed point and 'enum E' is not yet supported}}
47   ptr = accum;     // expected-error{{assigning to 'int *' from incompatible type '_Accum'}}
48   ptr = accum_ptr; // expected-warning{{incompatible pointer types assigning to 'int *' from '_Accum *'}}
49   i2 = accum;      // expected-error{{conversion between fixed point and 'int' is not yet supported}}
50 }
51