aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2014-06-20 14:32:35 -0400
committerJason Merrill <jason@gcc.gnu.org>2014-06-20 14:32:35 -0400
commitcaa40bc0fce7db55c6c24b8541be490330aa1ca0 (patch)
tree6f2ff02ff6f7e5de655b02a7260beb58d094b618
parente2498d54f06c0bab7977047e5ab0277e69fc6319 (diff)
downloadgcc-caa40bc0fce7db55c6c24b8541be490330aa1ca0.zip
gcc-caa40bc0fce7db55c6c24b8541be490330aa1ca0.tar.gz
gcc-caa40bc0fce7db55c6c24b8541be490330aa1ca0.tar.bz2
re PR c++/59296 ([c++11] ref-qualified member function is ambiguous)
PR c++/59296 * call.c (add_function_candidate): Avoid special 'this' handling if we have a ref-qualifier. From-SVN: r211854
-rw-r--r--gcc/cp/ChangeLog4
-rw-r--r--gcc/cp/call.c15
2 files changed, 12 insertions, 7 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index b437954..a8bc633 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,5 +1,9 @@
2014-06-20 Jason Merrill <jason@redhat.com>
+ PR c++/59296
+ * call.c (add_function_candidate): Avoid special 'this' handling
+ if we have a ref-qualifier.
+
PR c++/61556
* call.c (build_over_call): Call build_this in template path.
diff --git a/gcc/cp/call.c b/gcc/cp/call.c
index da91433..4847c3a 100644
--- a/gcc/cp/call.c
+++ b/gcc/cp/call.c
@@ -2025,9 +2025,9 @@ 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);
- /* Don't bind an rvalue to a const lvalue ref-qualifier. */
- if (!rv)
- lflags |= LOOKUP_NO_RVAL_BIND|LOOKUP_NO_TEMP_BIND;
+ /* The special handling of 'this' conversions in compare_ics
+ does not apply if there is a ref-qualifier. */
+ is_this = false;
}
else
{
@@ -8597,10 +8597,11 @@ compare_ics (conversion *ics1, conversion *ics2)
/* [over.ics.rank]
--S1 and S2 are reference bindings (_dcl.init.ref_) and neither refers
- to an implicit object parameter, and either S1 binds an lvalue reference
- to an lvalue and S2 binds an rvalue reference or S1 binds an rvalue
- reference to an rvalue and S2 binds an lvalue reference
- (C++0x draft standard, 13.3.3.2)
+ to an implicit object parameter of a non-static member function
+ declared without a ref-qualifier, and either S1 binds an lvalue
+ reference to an lvalue and S2 binds an rvalue reference or S1 binds an
+ rvalue reference to an rvalue and S2 binds an lvalue reference (C++0x
+ draft standard, 13.3.3.2)
--S1 and S2 are reference bindings (_dcl.init.ref_), and the
types to which the references refer are the same type except for