https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103427
--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> --- (In reply to Jonathan Wakely from comment #0) > Since https://reviews.llvm.org/D99790 Clang optimizes it: Oops, I meant to paste this, from clang 13.0.0 at -O1 f(int&): # @f(int&) mov rax, rdi ret My::Test1(): # @My::Test1() mov rax, rdi ret My::Test2(): # @My::Test2() mov rax, rdi ret The int& case has been optimized since Clang 11.0.0, and 13.0.0 started doing the same for the 'this' pointer.