https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101312
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jakub at gcc dot gnu.org
--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
I think this is about the differences between the generic build_qualified_type
and the C/C++ FE c_build_qualified_type.
build_type_attribute_qual_variant currently uses
ttype = build_qualified_type (ttype, TYPE_UNQUALIFIED);
if (lang_hooks.types.copy_lang_qualifiers
&& otype != TYPE_MAIN_VARIANT (otype))
ttype = (lang_hooks.types.copy_lang_qualifiers
(ttype, TYPE_MAIN_VARIANT (otype)));
and
ttype = build_qualified_type (ntype, quals);
if (lang_hooks.types.copy_lang_qualifiers
&& otype != TYPE_MAIN_VARIANT (otype))
ttype = lang_hooks.types.copy_lang_qualifiers (ttype, otype);
in two spots and it is just the C++ FE which sets copy_lang_qualifiers langhook
to non-NULL and it is solely these two spots that use the langhook.
So, I wonder if we shouldn't nuke the copy_lang_qualifiers langhook and add a
new one
for build_qualified_type and use it either in these 2 or perhaps 3 (at the end
of the same function) spots, defaulting to build_qualified_type and overridden
by C and C++ FE to deal at least with ARRAY_TYPEs the normal C/C++ FE way and
deal with the qualifiers for C++ too.
The langhook has been added for PR70029.