xref: /minix3/external/bsd/llvm/dist/clang/test/Sema/complex-imag.c (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -verify %s
2*f4a2713aSLionel Sambuc 
f1()3*f4a2713aSLionel Sambuc void f1() {
4*f4a2713aSLionel Sambuc   int a = 1;
5*f4a2713aSLionel Sambuc   int b = __imag a;
6*f4a2713aSLionel Sambuc   int *c = &__real a;
7*f4a2713aSLionel Sambuc   int *d = &__imag a; // expected-error {{cannot take the address of an rvalue of type 'int'}}
8*f4a2713aSLionel Sambuc }
9*f4a2713aSLionel Sambuc 
f2()10*f4a2713aSLionel Sambuc void f2() {
11*f4a2713aSLionel Sambuc   _Complex int a = 1;
12*f4a2713aSLionel Sambuc   int b = __imag a;
13*f4a2713aSLionel Sambuc   int *c = &__real a;
14*f4a2713aSLionel Sambuc   int *d = &__imag a;
15*f4a2713aSLionel Sambuc }
16*f4a2713aSLionel Sambuc 
f3()17*f4a2713aSLionel Sambuc void f3() {
18*f4a2713aSLionel Sambuc   double a = 1;
19*f4a2713aSLionel Sambuc   double b = __imag a;
20*f4a2713aSLionel Sambuc   double *c = &__real a;
21*f4a2713aSLionel Sambuc   double *d = &__imag a; // expected-error {{cannot take the address of an rvalue of type 'double'}}
22*f4a2713aSLionel Sambuc }
23*f4a2713aSLionel Sambuc 
f4()24*f4a2713aSLionel Sambuc void f4() {
25*f4a2713aSLionel Sambuc   _Complex double a = 1;
26*f4a2713aSLionel Sambuc   double b = __imag a;
27*f4a2713aSLionel Sambuc   double *c = &__real a;
28*f4a2713aSLionel Sambuc   double *d = &__imag a;
29*f4a2713aSLionel Sambuc }
30