https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101273
--- Comment #2 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Iain Buclaw <ibuc...@gcc.gnu.org>: https://gcc.gnu.org/g:152f4d0e4d3b524ce30d05f20e23a44b0dd29765 commit r12-1995-g152f4d0e4d3b524ce30d05f20e23a44b0dd29765 Author: Iain Buclaw <ibuc...@gdcproject.org> Date: Sat Jul 3 02:42:14 2021 +0200 d: Missed RVO optimization with non-POD structs The D front-end semantic pass sometimes declares a temporary inside a return expression. This is now detected with the RESULT_DECL replacing the temporary, allowing for RVO to be done. PR d/101273 gcc/d/ChangeLog: * toir.cc (IRVisitor::visit (ReturnStatement *)): Detect returns that use a temporary, and replace with return value. gcc/testsuite/ChangeLog: * gdc.dg/torture/pr101273.d: New test.