https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97474
Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jason at gcc dot gnu.org, | |mpolacek at gcc dot gnu.org, | |ppalka at gcc dot gnu.org --- Comment #10 from Jakub Jelinek <jakub at gcc dot gnu.org> --- I think the place in the C++ FE that adds restrict here is: tree type_passed_as (tree type) { /* Pass classes with copy ctors by invisible reference. */ if (TREE_ADDRESSABLE (type)) { type = build_reference_type (type); /* There are no other pointers to this temporary. */ type = cp_build_qualified_type (type, TYPE_QUAL_RESTRICT); } So, the options are either not to do it for types that contain any pointers/references among its members, or do some extra analysis as to whether even if it contains some pointers/references if those are guaranteed not to point to anything within the structure (e.g. because of TBAA rules), or using that analysis decide if it can use normal restrict or needs to use a weaker restrict, etc.