diff options
author | Nathan Sidwell <nathan@codesourcery.com> | 2007-09-16 17:26:42 +0000 |
---|---|---|
committer | Nathan Sidwell <nathan@gcc.gnu.org> | 2007-09-16 17:26:42 +0000 |
commit | 0ee3f0a892918371a5245de973480bc443126558 (patch) | |
tree | 16195234eba827edd3e29d3d1df861daf7be358d /gcc/cp | |
parent | ce616dd5acdb51f6ee1705e95c20b1f9f4e41525 (diff) | |
download | gcc-0ee3f0a892918371a5245de973480bc443126558.zip gcc-0ee3f0a892918371a5245de973480bc443126558.tar.gz gcc-0ee3f0a892918371a5245de973480bc443126558.tar.bz2 |
re PR c++/32756 (wrong ambiguous overload error?)
cp/
PR c++/32756
* call.c (maybe_handle_implicit_object): Set this_p, clear
rvaluedness_matches_p.
(compare_ics): Do not compare rvaluedness matching when one of the
operands is an implicit object.
testsuite/
PR c++/32756
* g++.dg/overload/operator3.C: New.
From-SVN: r128528
Diffstat (limited to 'gcc/cp')
-rw-r--r-- | gcc/cp/ChangeLog | 13 | ||||
-rw-r--r-- | gcc/cp/call.c | 26 |
2 files changed, 28 insertions, 11 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 26028a5..6e8a8b9 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,16 @@ +2007-09-16 Nathan Sidwell <nathan@codesourcery.com> + + cp/ + PR c++/32756 + * call.c (maybe_handle_implicit_object): Set this_p, clear + rvaluedness_matches_p. + (compare_ics): Do not compare rvaluedness matching when one of the + operands is an implicit object. + + testsuite/ + PR c++/32756 + * g++.dg/overload/operator3.C: New. + 2007-09-14 Jason Merrill <jason@redhat.com> PR c++/17743, c++/19163 diff --git a/gcc/cp/call.c b/gcc/cp/call.c index dd41b9d..dc90d19 100644 --- a/gcc/cp/call.c +++ b/gcc/cp/call.c @@ -5767,7 +5767,8 @@ maybe_handle_implicit_object (conversion **ics) t = t->u.next; t = build_identity_conv (TREE_TYPE (t->type), NULL_TREE); t = direct_reference_binding (reference_type, t); - t->rvaluedness_matches_p = 1; + t->this_p = 1; + t->rvaluedness_matches_p = 0; *ics = t; } } @@ -6126,18 +6127,21 @@ compare_ics (conversion *ics1, conversion *ics2) initialized by S2 refers is more cv-qualified than the type to which the reference initialized by S1 refers */ - if (ref_conv1 && ref_conv2 - && same_type_ignoring_top_level_qualifiers_p (to_type1, to_type2)) + if (ref_conv1 && ref_conv2) { - if (ref_conv1->rvaluedness_matches_p - && !ref_conv2->rvaluedness_matches_p) - return 1; - else if (!ref_conv1->rvaluedness_matches_p - && ref_conv2->rvaluedness_matches_p) - return -1; + if (!ref_conv1->this_p && !ref_conv2->this_p + && (TYPE_REF_IS_RVALUE (ref_conv1->type) + != TYPE_REF_IS_RVALUE (ref_conv2->type))) + { + if (ref_conv1->rvaluedness_matches_p) + return 1; + if (ref_conv2->rvaluedness_matches_p) + return -1; + } - return comp_cv_qualification (TREE_TYPE (ref_conv2->type), - TREE_TYPE (ref_conv1->type)); + if (same_type_ignoring_top_level_qualifiers_p (to_type1, to_type2)) + return comp_cv_qualification (TREE_TYPE (ref_conv2->type), + TREE_TYPE (ref_conv1->type)); } /* Neither conversion sequence is better than the other. */ |