https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65690
--- Comment #2 from Jan Hubicka <hubicka at gcc dot gnu.org> --- I see, C++ has special code for building qualified array types. I would say that build_cplus_array_type should have a path where it is building a variant and go via build_distinct_type_copy only adjusting the array type w/o re-doing the layout. This way also the type attributes and other stuff will be preserved.