https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94609
--- Comment #7 from Iain Buclaw <ibuclaw at gdcproject dot org> --- I'm initially considering the following: --- a/gcc/d/types.cc +++ b/gcc/d/types.cc @@ -915,7 +915,7 @@ public: /* For structs with a user defined postblit or a destructor, also set TREE_ADDRESSABLE on the type and all variants. This will make the struct be passed around by reference. */ - if (t->sym->postblit || t->sym->dtor) + if (t->sym->enclosing || t->sym->postblit || t->sym->dtor) { for (tree tv = t->ctype; tv != NULL_TREE; tv = TYPE_NEXT_VARIANT (tv)) TREE_ADDRESSABLE (tv) = 1; However the front-end for some time now has implemented an isPOD method that recursively checks all fields too. It would be better to use this instead. --- a/gcc/d/types.cc +++ b/gcc/d/types.cc @@ -915,7 +915,7 @@ public: /* For structs with a user defined postblit or a destructor, also set TREE_ADDRESSABLE on the type and all variants. This will make the struct be passed around by reference. */ - if (t->sym->postblit || t->sym->dtor) + if (!t->sym->isPOD ()) { for (tree tv = t->ctype; tv != NULL_TREE; tv = TYPE_NEXT_VARIANT (tv)) TREE_ADDRESSABLE (tv) = 1; The test itself now passes with the above, but going to rebuild the library and run it on the wider testsuite.