[Bug c++/57575] lvalue function accepted as an rvalue
anass.lasram at gmail dot com
gcc-bugzilla@gcc.gnu.org
Mon Jun 10 18:52:00 GMT 2013
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57575
Anass Lasram <anass.lasram at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution|--- |INVALID
--- Comment #2 from Anass Lasram <anass.lasram at gmail dot com> ---
(In reply to Daniel Krügler from comment #1)
> Your assumptions are mistaken. In C++ it is valid to bind a function value
> to an rvalue reference of that function type. It is only so, that binding to
> an lvalue reference is preferred.
>
> In other words, the following is valid as well:
>
> float f() { return 0.f; }
> float (&&r)(void) = f;
>
> See for example [over.ics.ref] p3 (emphasis mine):
>
> "Except for an implicit object parameter, for which see 13.3.1, a standard
> conversion sequence cannot be formed if it requires [..] binding an rvalue
> reference to an lvalue **other than a function lvalue**."
Thanks Daniel for the rectification.
More information about the Gcc-bugs
mailing list