1 // P2334R1
2 // { dg-do preprocess }
3 // { dg-options "-pedantic" }
4 
5 #define A
6 #undef B
7 
8 #if 0
9 #elifdef A	// { dg-warning "#elifdef before C\\\+\\\+23 is a GCC extension" "" { target c++20_down } }
10 #define M1 1
11 #endif
12 
13 #if M1 != 1
14 #error "#elifdef A did not apply"
15 #endif
16 
17 #if 0
18 #elifdef B
19 #error "#elifdef B applied"
20 #endif
21 
22 #if 0
23 #elifndef A
24 #error "#elifndef A applied"
25 #endif
26 
27 #if 0
28 #elifndef B	// { dg-warning "#elifndef before C\\\+\\\+23 is a GCC extension" "" { target c++20_down } }
29 #define M2 2
30 #endif
31 
32 #if M2 != 2
33 #error "#elifndef B did not apply"
34 #endif
35 
36 #if 0
37 #elifdef A	// { dg-warning "#elifdef before C\\\+\\\+23 is a GCC extension" "" { target c++20_down } }
38 #else
39 #error "#elifdef A did not apply"
40 #endif
41 
42 #if 0
43 #elifndef B	// { dg-warning "#elifndef before C\\\+\\\+23 is a GCC extension" "" { target c++20_down } }
44 #else
45 #error "#elifndef B did not apply"
46 #endif
47 
48 #if 1
49 #elifdef A	// { dg-warning "#elifdef before C\\\+\\\+23 is a GCC extension" "" { target c++20_down } }
50 #endif
51 
52 #if 1
53 #elifndef B	// { dg-warning "#elifndef before C\\\+\\\+23 is a GCC extension" "" { target c++20_down } }
54 #endif
55 
56 // As with #elif, the syntax of the new directives is relaxed after a
57    non-skipped group.
58 
59 #if 1
60 #elifdef x * y	// { dg-warning "#elifdef before C\\\+\\\+23 is a GCC extension" "" { target c++20_down } }
61 #endif
62 
63 #if 1
64 #elifndef !	// { dg-warning "#elifndef before C\\\+\\\+23 is a GCC extension" "" { target c++20_down } }
65 #endif
66