Maybe I misunderstood, but I thought that you were arguing that with link-time optimization the compiler could see through cases such as the one I have given. As a counterargument, I brought up functions that are implemented in shared libraries, which are essential a blackbox to the compiler.
> The issue here are references, of which the compiler figures out whether this should work like a value or like a pointer.
I'm not sure I understand. A C++ reference always has reference semantics. Can you give an example?