https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79671
--- Comment #98 from Bernd Edlinger <bernd.edlinger at hotmail dot de> --- I realized that my latest patch triggers a pre-existing bug in the libstdc++ testsuite => PR80287 So the following patch would be needed on top of it: Index: gcc/cp/class.c =================================================================== --- gcc/cp/class.c (revision 246605) +++ gcc/cp/class.c (working copy) @@ -2060,12 +2060,14 @@ static void fixup_may_alias (tree klass) { - tree t; + tree t, v; for (t = TYPE_POINTER_TO (klass); t; t = TYPE_NEXT_PTR_TO (t)) - TYPE_REF_CAN_ALIAS_ALL (t) = true; + for (v = TYPE_MAIN_VARIANT (t); v; v = TYPE_NEXT_VARIANT (v)) + TYPE_REF_CAN_ALIAS_ALL (v) = true; for (t = TYPE_REFERENCE_TO (klass); t; t = TYPE_NEXT_REF_TO (t)) - TYPE_REF_CAN_ALIAS_ALL (t) = true; + for (v = TYPE_MAIN_VARIANT (t); v; v = TYPE_NEXT_VARIANT (v)) + TYPE_REF_CAN_ALIAS_ALL (v) = true; } /* Early variant fixups: we apply attributes at the beginning of the class