https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116892
--- Comment #6 from uecker at gcc dot gnu.org --- Maybe something like that will do? diff --git a/gcc/c/c-decl.cc b/gcc/c/c-decl.cc index 8c420f22976..fb1216fe808 100644 --- a/gcc/c/c-decl.cc +++ b/gcc/c/c-decl.cc @@ -10303,6 +10303,7 @@ finish_enum (tree enumtype, tree values, tree attributes) TYPE_UNSIGNED (tem) = TYPE_UNSIGNED (enumtype); TYPE_LANG_SPECIFIC (tem) = TYPE_LANG_SPECIFIC (enumtype); ENUM_UNDERLYING_TYPE (tem) = ENUM_UNDERLYING_TYPE (enumtype); + TYPE_PACKED (tem) = TYPE_PACKED (enumtype); } /* Finish debugging output for this type. */ diff --git a/gcc/testsuite/gcc.dg/pr116892.c b/gcc/testsuite/gcc.dg/pr116892.c new file mode 100644 index 00000000000..4cfa935eb72 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr116892.c @@ -0,0 +1,11 @@ +/* { dg-do compile } */ + + +enum fmt_type; + +void foo(const enum fmt_type a); + +enum [[gnu::packed]] fmt_type { + A +} const a; +