xref: /llvm-project/clang/test/Frontend/fixed_point_unknown_conversions.c (revision 7de71613049fa1333ef819b6dc740356ff4efff5)
199bda375SLeonard Chan // RUN: %clang_cc1 -verify -ffixed-point %s
299bda375SLeonard Chan 
func(void)3*7de71613SAaron Ballman void func(void) {
499bda375SLeonard Chan   _Bool b;
599bda375SLeonard Chan   char c;
699bda375SLeonard Chan   int i;
799bda375SLeonard Chan   float f;
899bda375SLeonard Chan   double d;
999bda375SLeonard Chan   double _Complex dc;
1099bda375SLeonard Chan   int _Complex ic;
1199bda375SLeonard Chan   struct S {
1299bda375SLeonard Chan     int i;
1399bda375SLeonard Chan   } s;
1499bda375SLeonard Chan   enum E {
1599bda375SLeonard Chan     A
1699bda375SLeonard Chan   } e;
1799bda375SLeonard Chan   int *ptr;
1899bda375SLeonard Chan   typedef int int_t;
1999bda375SLeonard Chan   int_t i2;
2099bda375SLeonard Chan 
2199bda375SLeonard Chan   _Accum accum;
2299bda375SLeonard Chan   _Fract fract = accum; // ok
2399bda375SLeonard Chan   _Accum *accum_ptr;
2499bda375SLeonard Chan 
2599bda375SLeonard Chan   accum = dc;      // expected-error{{conversion between fixed point and '_Complex double' is not yet supported}}
2699bda375SLeonard Chan   accum = ic;      // expected-error{{conversion between fixed point and '_Complex int' is not yet supported}}
2799bda375SLeonard Chan   accum = s;       // expected-error{{assigning to '_Accum' from incompatible type 'struct S'}}
2899bda375SLeonard Chan   accum = ptr;     // expected-error{{assigning to '_Accum' from incompatible type 'int *'}}
2999bda375SLeonard Chan   accum_ptr = ptr; // expected-warning{{incompatible pointer types assigning to '_Accum *' from 'int *'}}
3099bda375SLeonard Chan 
3199bda375SLeonard Chan   dc = accum;      // expected-error{{conversion between fixed point and '_Complex double' is not yet supported}}
3299bda375SLeonard Chan   ic = accum;      // expected-error{{conversion between fixed point and '_Complex int' is not yet supported}}
3399bda375SLeonard Chan   s = accum;       // expected-error{{assigning to 'struct S' from incompatible type '_Accum'}}
3499bda375SLeonard Chan   ptr = accum;     // expected-error{{assigning to 'int *' from incompatible type '_Accum'}}
3599bda375SLeonard Chan   ptr = accum_ptr; // expected-warning{{incompatible pointer types assigning to 'int *' from '_Accum *'}}
3699bda375SLeonard Chan }
37