[Bug other/60783] unexpected address variation when taking address of reference, const reference, etc.

redi at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Mon Apr 7 20:49:00 GMT 2014


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60783

--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Parke from comment #0)
> I in the output, I expect "e" through "l" to be identical.

Your expectation is wrong.

The functions that produce a different values from what you expect are binding
a reference of some type X to an object that is not reference-compatible with
X, which requires the creation of a temporary of type X. The temporary has a
different address from the original object.

Any conforming C++ compiler will produce similar results.



More information about the Gcc-bugs mailing list