http://gcc.gnu.org/bugzilla/show_bug.cgi?id=61082
--- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> --- extern "C" int printf(const char*, ...); struct B { }; struct X : public B { long p; }; struct Y : public B { X q; }; Y foo( Y& y ) { Y temp; temp = y; return temp; } int main( void ) { printf("%zd %zd\n", sizeof( X ), sizeof( Y )); Y y; y.q.p = 6L; Y yy = foo( y ); printf("%ld\n", yy.q.p); } Clang uses the same registers as GCC: .globl _Z3fooR1Y .align 16, 0x90 .type _Z3fooR1Y,@function _Z3fooR1Y: # @_Z3fooR1Y .cfi_startproc # BB#0: # %entry movq 8(%rdi), %rax retq .Ltmp0: .size _Z3fooR1Y, .Ltmp0-_Z3fooR1Y .cfi_endproc