Richard Smith | dfb80de | 2012-02-18 20:53:32 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -verify %s |
| 2 | |
| 3 | void f1() { |
| 4 | int a = 1; |
| 5 | int b = __imag a; |
| 6 | int *c = &__real a; |
Richard Smith | 3fa3fea | 2013-02-02 02:14:45 +0000 | [diff] [blame] | 7 | int *d = &__imag a; // expected-error {{cannot take the address of an rvalue of type 'int'}} |
Richard Smith | dfb80de | 2012-02-18 20:53:32 +0000 | [diff] [blame] | 8 | } |
| 9 | |
| 10 | void f2() { |
| 11 | _Complex int a = 1; |
| 12 | int b = __imag a; |
| 13 | int *c = &__real a; |
| 14 | int *d = &__imag a; |
| 15 | } |
| 16 | |
| 17 | void f3() { |
| 18 | double a = 1; |
| 19 | double b = __imag a; |
| 20 | double *c = &__real a; |
Richard Smith | 3fa3fea | 2013-02-02 02:14:45 +0000 | [diff] [blame] | 21 | double *d = &__imag a; // expected-error {{cannot take the address of an rvalue of type 'double'}} |
Richard Smith | dfb80de | 2012-02-18 20:53:32 +0000 | [diff] [blame] | 22 | } |
| 23 | |
| 24 | void f4() { |
| 25 | _Complex double a = 1; |
| 26 | double b = __imag a; |
| 27 | double *c = &__real a; |
| 28 | double *d = &__imag a; |
| 29 | } |