This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/57575] lvalue function accepted as an rvalue
- From: "daniel.kruegler at googlemail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 10 Jun 2013 12:06:22 +0000
- Subject: [Bug c++/57575] lvalue function accepted as an rvalue
- Auto-submitted: auto-generated
- References: <bug-57575-4 at http dot gcc dot gnu dot org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57575
Daniel KrÃgler <daniel.kruegler at googlemail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |daniel.kruegler@googlemail.
| |com
--- Comment #1 from Daniel KrÃgler <daniel.kruegler at googlemail dot com> ---
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**."