4
4
// RUN: %clang_cc1 -Weverything -std=c11 -xc -DC11 -verify %s
5
5
// RUN: %clang_cc1 -pedantic -std=c11 -xc -DC11 -verify %s
6
6
// RUN: %clang_cc1 -Weverything -std=c11 -xc -fms-extensions -DMS -verify %s
7
+ // RUN: %clang_cc1 -Weverything -std=c2x -xc -DC23 -verify %s
8
+ // RUN: %clang_cc1 -pedantic -std=c2x -xc -DC23 -verify %s
9
+ // RUN: %clang_cc1 -Weverything -std=c23 -xc -DC23 -verify %s
10
+ // RUN: %clang_cc1 -pedantic -std=c23 -xc -DC23 -verify %s
11
+ // RUN: %clang_cc1 -Weverything -std=c23 -xc -fms-extensions -DC23 -verify %s
7
12
8
13
enum X : int {e };
9
14
#if defined(CXX11 )
10
15
// expected-warning@-2{{enumeration types with a fixed underlying type are incompatible with C++98}}
11
16
#elif defined(CXX03 )
12
17
// expected-warning@-4{{enumeration types with a fixed underlying type are a C++11 extension}}
13
- #elif defined(OBJC )
18
+ #elif defined(OBJC ) || defined( C23 )
14
19
// No diagnostic
15
20
#elif defined(C11 )
16
21
// expected-warning@-8{{enumeration types with a fixed underlying type are a Clang extension}}
@@ -21,19 +26,19 @@ enum X : int {e};
21
26
// Don't warn about the forward declaration in any language mode.
22
27
enum Fwd : int ;
23
28
enum Fwd : int { e2 };
24
- #ifndef OBJC
29
+ #if !defined( OBJC ) && !defined( C23 )
25
30
// expected-warning@-3 {{enumeration types with a fixed underlying type}}
26
31
// expected-warning@-3 {{enumeration types with a fixed underlying type}}
27
32
#endif
28
33
29
34
// Always error on the incompatible redeclaration.
30
35
enum BadFwd : int ;
31
- #ifndef OBJC
36
+ #if !defined( OBJC ) && !defined( C23 )
32
37
// expected-warning@-2 {{enumeration types with a fixed underlying type}}
33
38
#endif
34
39
// expected-note@-4 {{previous declaration is here}}
35
40
enum BadFwd : char { e3 };
36
- #ifndef OBJC
41
+ #if !defined( OBJC ) && !defined( C23 )
37
42
// expected-warning@-2 {{enumeration types with a fixed underlying type}}
38
43
#endif
39
44
// expected-error@-4 {{enumeration redeclared with different underlying type 'char' (was 'int')}}
0 commit comments