aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/call.c
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2011-04-11 18:00:06 -0400
committerJason Merrill <jason@gcc.gnu.org>2011-04-11 18:00:06 -0400
commitb24290fb5bfba313dc7143aa29a7b161fd501997 (patch)
treedd92eb9594d145c9a1cbd548aadb98292d461fc5 /gcc/cp/call.c
parent1e6d1da02d97cb863bd000c90d0309ba8f630955 (diff)
downloadgcc-b24290fb5bfba313dc7143aa29a7b161fd501997.zip
gcc-b24290fb5bfba313dc7143aa29a7b161fd501997.tar.gz
gcc-b24290fb5bfba313dc7143aa29a7b161fd501997.tar.bz2
PR c++/48457, Core 1238
PR c++/48457, Core 1238 * call.c (reference_binding): Allow rvalue reference to bind to function lvalue. * tree.c (lvalue_kind): Functions are always lvalues. From-SVN: r172282
Diffstat (limited to 'gcc/cp/call.c')
-rw-r--r--gcc/cp/call.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/gcc/cp/call.c b/gcc/cp/call.c
index 096fbbc..4d03646 100644
--- a/gcc/cp/call.c
+++ b/gcc/cp/call.c
@@ -1521,8 +1521,10 @@ reference_binding (tree rto, tree rfrom, tree expr, bool c_cast_p, int flags)
actually occurs. */
conv->need_temporary_p = true;
- /* Don't allow binding of lvalues to rvalue references. */
+ /* Don't allow binding of lvalues (other than function lvalues) to
+ rvalue references. */
if (is_lvalue && TYPE_REF_IS_RVALUE (rto)
+ && TREE_CODE (to) != FUNCTION_TYPE
&& !(flags & LOOKUP_PREFER_RVALUE))
conv->bad_p = true;