xref: /llvm-project/clang/test/Sema/complex-imag.c (revision 48508c13500908079ae605ad4bd6be075e46f5fb)
1 // RUN: %clang_cc1 -verify %s
2 
f1(void)3 void f1(void) {
4   int a = 1;
5   int b = __imag a;
6   int *c = &__real a;
7   int *d = &__imag a; // expected-error {{cannot take the address of an rvalue of type 'int'}}
8 }
9 
f2(void)10 void f2(void) {
11   _Complex int a = 1;
12   int b = __imag a;
13   int *c = &__real a;
14   int *d = &__imag a;
15 }
16 
f3(void)17 void f3(void) {
18   double a = 1;
19   double b = __imag a;
20   double *c = &__real a;
21   double *d = &__imag a; // expected-error {{cannot take the address of an rvalue of type 'double'}}
22 }
23 
f4(void)24 void f4(void) {
25   _Complex double a = 1;
26   double b = __imag a;
27   double *c = &__real a;
28   double *d = &__imag a;
29 }
30 
31 // PR69218
f5(void)32 int f5(void) {
33   float _Complex a;
34   return (0 < &__real__ a) && (0 < &__imag__ a);
35 }
36