re PR c++/49458 ([C++0x][DR 1328] Obvious candidate for conversion to function lvalue rejected)
PR c++/49458 * call.c (convert_class_to_reference_1): Allow binding function lvalue to rvalue reference. From-SVN: r175164
This commit is contained in:
parent
65e5579c29
commit
dfe8601ce7
4 changed files with 18 additions and 0 deletions
|
@ -1,5 +1,9 @@
|
|||
2011-06-17 Jason Merrill <jason@redhat.com>
|
||||
|
||||
PR c++/49458
|
||||
* call.c (convert_class_to_reference_1): Allow binding function
|
||||
lvalue to rvalue reference.
|
||||
|
||||
PR c++/43912
|
||||
Generate proxy VAR_DECLs for better lambda debug info.
|
||||
* cp-tree.h (FUNCTION_NEEDS_BODY_BLOCK): Add lambda operator().
|
||||
|
|
|
@ -1362,6 +1362,8 @@ convert_class_to_reference_1 (tree reference_type, tree s, tree expr, int flags)
|
|||
|
||||
/* Don't allow binding of lvalues to rvalue references. */
|
||||
if (TYPE_REF_IS_RVALUE (reference_type)
|
||||
/* Function lvalues are OK, though. */
|
||||
&& TREE_CODE (TREE_TYPE (reference_type)) != FUNCTION_TYPE
|
||||
&& !TYPE_REF_IS_RVALUE (TREE_TYPE (TREE_TYPE (cand->fn))))
|
||||
cand->second_conv->bad_p = true;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
2011-06-17 Jason Merrill <jason@redhat.com>
|
||||
|
||||
* g++.dg/cpp0x/rv-func2.C: New.
|
||||
|
||||
* g++.dg/debug/dwarf2/lambda1.C: New.
|
||||
* g++.dg/warn/Wshadow-6.C: Adjust.
|
||||
|
||||
|
|
10
gcc/testsuite/g++.dg/cpp0x/rv-func2.C
Normal file
10
gcc/testsuite/g++.dg/cpp0x/rv-func2.C
Normal file
|
@ -0,0 +1,10 @@
|
|||
// PR c++/49458
|
||||
// { dg-options -std=c++0x }
|
||||
|
||||
typedef void ftype();
|
||||
|
||||
struct A {
|
||||
operator ftype&(void);
|
||||
};
|
||||
|
||||
ftype &&frvref = A();
|
Loading…
Add table
Reference in a new issue