commit 5742904a95f4daaa0752bea6e1599e82197419b0
Author: Jason Merrill <jason@redhat.com>
Date: Thu Apr 25 10:38:47 2013 -0400
PR c++/57064
* call.c (add_function_candidate): Strip ref-to-ptr conversion.
@@ -1959,6 +1959,10 @@ add_function_candidate (struct z_candidate **candidates,
object parameter has reference type. */
bool rv = FUNCTION_RVALUE_QUALIFIED (TREE_TYPE (fn));
parmtype = cp_build_reference_type (parmtype, rv);
+ if (TREE_CODE (arg) == CONVERT_EXPR
+ && TYPE_PTR_P (TREE_TYPE (arg)))
+ /* Strip conversion from reference to pointer. */
+ arg = TREE_OPERAND (arg, 0);
arg = build_fold_indirect_ref (arg);
argtype = lvalue_type (arg);
}
new file mode 100644
@@ -0,0 +1,14 @@
+// PR c++/57064
+// { dg-require-effective-target c++11 }
+
+template <class T> T&& move(T& t);
+
+struct A {
+ void p() &;
+ int p() &&;
+};
+
+void g(A &&a)
+{
+ int i = move(a).p();
+}