complex-imag.c 589 B

1234567891011121314151617181920212223242526272829
  1. // RUN: %clang_cc1 -verify %s
  2. void f1() {
  3. int a = 1;
  4. int b = __imag a;
  5. int *c = &__real a;
  6. int *d = &__imag a; // expected-error {{cannot take the address of an rvalue of type 'int'}}
  7. }
  8. void f2() {
  9. _Complex int a = 1;
  10. int b = __imag a;
  11. int *c = &__real a;
  12. int *d = &__imag a;
  13. }
  14. void f3() {
  15. double a = 1;
  16. double b = __imag a;
  17. double *c = &__real a;
  18. double *d = &__imag a; // expected-error {{cannot take the address of an rvalue of type 'double'}}
  19. }
  20. void f4() {
  21. _Complex double a = 1;
  22. double b = __imag a;
  23. double *c = &__real a;
  24. double *d = &__imag a;
  25. }