https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116357
--- Comment #10 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
So, shall we go for
--- gcc/c/c-decl.cc.jj 2025-01-21 09:13:54.523510241 +0100
+++ gcc/c/c-decl.cc 2025-01-24 15:31:46.698725165 +0100
@@ -7058,7 +7058,7 @@ grokdeclarator (const struct c_declarato
&& TYPE_QUALS (element_type))
{
orig_qual_type = type;
- type = TYPE_MAIN_VARIANT (type);
+ type = build_qualified_type (type, TYPE_UNQUALIFIED);
}
type_quals = ((constp ? TYPE_QUAL_CONST : 0)
| (restrictp ? TYPE_QUAL_RESTRICT : 0)
?