PR middle-end/27945
[official-gcc.git] / gcc / testsuite / gcc.dg / c99-complex-1.c
blob2e1ba7df539ad664e254d39bee36825b38c9e377
1 /* Test for _Complex: in C99 only. A few basic tests. */
2 /* Origin: Joseph Myers <jsm28@cam.ac.uk> */
3 /* { dg-do compile } */
4 /* { dg-options "-std=iso9899:1999 -pedantic-errors" } */
6 /* Test _Complex allowed on floating types. */
8 float _Complex a;
9 _Complex float b;
10 double _Complex c;
11 _Complex double d;
12 long double _Complex e;
13 _Complex long double f;
15 /* Plain `_Complex' for complex double is a GNU extension. */
16 _Complex g; /* { dg-bogus "warning" "warning in place of error" } */
17 /* { dg-error "plain" "plain _Complex" { target *-*-* } 16 } */
19 /* Complex integer types are GNU extensions. */
20 _Complex int h; /* { dg-bogus "warning" "warning in place of error" } */
21 /* { dg-error "complex integer" "_Complex int" { target *-*-* } 20 } */
22 _Complex long i; /* { dg-bogus "warning" "warning in place of error" } */
23 /* { dg-error "complex integer" "_Complex long" { target *-*-* } 22 } */
25 /* Use of ~ for complex conjugation is a GNU extension, but a constraint
26 violation (6.5.3.3p1) in C99.
28 _Complex double
29 foo (_Complex double z)
31 return ~z; /* { dg-bogus "warning" "warning in place of error" } */
32 /* { dg-error "complex conj" "~ for conjugation" { target *-*-* } 31 } */