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" } */
5 
6 /* Test _Complex allowed on floating types.  */
7 
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;
14 
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 } */
18 
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 } */
24 
25 /* Use of ~ for complex conjugation is a GNU extension, but a constraint
26    violation (6.5.3.3p1) in C99.
27 */
28 _Complex double
foo(_Complex double z)29 foo (_Complex double z)
30 {
31   return ~z; /* { dg-bogus "warning" "warning in place of error" } */
32   /* { dg-error "complex conj" "~ for conjugation" { target *-*-* } 31 } */
33 }
34