Skip to content

Commit 405ca1d

Browse files
committed
Hopefully fix the precommit CI issues
1 parent 0bb04ba commit 405ca1d

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

clang/test/C/C23/n3037.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -404,15 +404,17 @@ _Static_assert(0 == _Generic(nontag_enum, enum { E_Untagged1 } : 1, default : 0)
404404

405405
// Test that enumerations are compatible with their underlying type, but still
406406
// diagnose when "same type" is required rather than merely "compatible type".
407+
enum E1 : int { e1 }; // Fixed underlying type
408+
enum E2 { e2 }; // Unfixed underlying type, defaults to int or unsigned int
409+
407410
struct GH149965_1 { int h; };
408-
struct GH149965_2 { int h; };
411+
// This typeof trick is used to get the underlying type of the enumeration in a
412+
// platform agnostic way.
413+
struct GH149965_2 { __typeof__(+(enum E2){}) h; };
409414
void gh149965(void) {
410415
extern struct GH149965_1 x1; // c17-note {{previous declaration is here}}
411416
extern struct GH149965_2 x2; // c17-note {{previous declaration is here}}
412417

413-
enum E1 : int { e1 }; // Fixed underlying type
414-
enum E2 { e2 }; // Unfixed underlying type, defaults to int in Clang (unsigned in GCC)
415-
416418
// Both the structure and the variable declarations are fine because only a
417419
// compatible type is required, not the same type, because the structures are
418420
// declared in different scopes.

0 commit comments

Comments
 (0)