https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112841
--- Comment #3 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Joseph Myers <js...@gcc.gnu.org>: https://gcc.gnu.org/g:84a335eb4f9641a471184d86900609dd97215218 commit r15-5598-g84a335eb4f9641a471184d86900609dd97215218 Author: Joseph Myers <josmy...@redhat.com> Date: Fri Nov 22 20:33:10 2024 +0000 c: Fix typeof_unqual handling of qualified array types [PR112841] As reported in bug 112841, typeof_unqual fails to remove qualifiers from qualified array types. In C23 (unlike in previous standard versions), array types are considered to have the qualifiers of the element type, so typeof_unqual should remove such qualifiers (and an example in the standard shows that is as intended). Fix this by calling strip_array_types when checking for the presence of qualifiers. (The reason we check for qualifiers rather than just using TYPE_MAIN_VARIANT unconditionally is to avoid, as a quality of implementation matter, unnecessarily losing typedef information in the case where the type is already unqualified.) Bootstrapped with no regressions for x86_64-pc-linux-gnu. PR c/112841 gcc/c/ * c-parser.cc (c_parser_typeof_specifier): Call strip_array_types when checking for type qualifiers for typeof_unqual. gcc/testsuite/ * gcc.dg/c23-typeof-4.c: New test.