[Bug c++/60517] warning/error for taking address of member of a temporary object
glisse at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Fri Mar 14 18:02:00 GMT 2014
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60517
Marc Glisse <glisse at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |glisse at gcc dot gnu.org
--- Comment #9 from Marc Glisse <glisse at gcc dot gnu.org> ---
(In reply to Manuel López-Ibáñez from comment #7)
> To avoid duplicates, the front-end could just return something else, like
> NULL, when it detects this case (I guess the behavior is undefined and we
> can do whatever we want, no?).
Actually, for a function that returns a reference, we may also want to warn if
we detect that it is returning NULL. And a function returning a pointer could
be marked returns_nonnull. In both cases we would be introducing a new warning,
more confusing than a duplicate. But there are probably small variations on
this idea that would work.
More information about the Gcc-bugs
mailing list