Debian Codegraph @

gcc/testsuite/gcc.dg/c23-imaginary-constants-7.c

raw
1 /* Test that imaginary constants are diagnosed in C23 mode: -pedantic. */
2 /* { dg-do run } */
3 /* { dg-options "-std=c23 -pedantic" } */
4 /* { dg-add-options float16 } */
5 /* { dg-require-effective-target float16 } */
6
7 _Complex _Float16 a = 1.if16; /* { dg-warning "imaginary constants are a C2Y feature or GCC extension" } */
8 _Complex _Float16 b = 2.F16j; /* { dg-warning "imaginary constants are a C2Y feature or GCC extension" } */
9 _Complex _Float16 c = 3.f16i; /* { dg-warning "imaginary constants are a C2Y feature or GCC extension" } */
10 _Complex _Float16 d = 4.JF16; /* { dg-warning "imaginary constants are a C2Y feature or GCC extension" } */
11 __extension__ _Complex _Float16 e = 1.if16;
12 __extension__ _Complex _Float16 f = 2.F16j;
13 __extension__ _Complex _Float16 g = 3.f16i;
14 __extension__ _Complex _Float16 h = 4.JF16;
15
16 int
17 main ()
18 {
19 if (a * a != -1.f16
20 || b * b != -4.f16
21 || c * c != -9.f16
22 || d * d != -16.f16
23 || e * e != -1.f16
24 || f * f != -4.f16
25 || g * g != -9.f16
26 || h * h != -16.f16)
27 __builtin_abort ();
28 }