https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88529
Bug ID: 88529 Summary: G++ clears the return register on x86_64 when returning an empty class Product: gcc Version: 8.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: rohan at rohanlean dot de Target Milestone: --- Target: x86_64 The following code causes G++ to emit an "xorl %eax, %eax" on x86_64. I believe the Itanium ABI does not require it, so this is a missed optimisation. class A{}; A f() { return {}; }