Commit 598c8c2c by Jason Merrill Committed by Jason Merrill

call.c (joust): Also warn about confusing conversion op/constructor overload resolution.

	* call.c (joust): Also warn about confusing conversion op/constructor
	overload resolution.

From-SVN: r20258
parent 1dd6b205
1998-06-05 Jason Merrill <jason@yorick.cygnus.com> 1998-06-05 Jason Merrill <jason@yorick.cygnus.com>
* call.c (joust): Also warn about confusing conversion op/constructor
overload resolution.
* spew.c (yylex): Also return the TYPE_DECL if got_object. * spew.c (yylex): Also return the TYPE_DECL if got_object.
Don't clear got_object after '~'. Don't clear got_object after '~'.
* call.c (build_scoped_method_call): Tweak destructor handling. * call.c (build_scoped_method_call): Tweak destructor handling.
......
...@@ -4298,12 +4298,10 @@ joust (cand1, cand2, warn) ...@@ -4298,12 +4298,10 @@ joust (cand1, cand2, warn)
} }
/* warn about confusing overload resolution */ /* warn about confusing overload resolution */
if (winner && cand1->second_conv if (winner && cand1->second_conv)
&& ! DECL_CONSTRUCTOR_P (cand1->fn)
&& ! DECL_CONSTRUCTOR_P (cand2->fn))
{ {
int comp = compare_ics (cand1->second_conv, cand2->second_conv); int comp = compare_ics (cand1->second_conv, cand2->second_conv);
if (comp && comp != winner) if (comp != winner)
{ {
struct z_candidate *w, *l; struct z_candidate *w, *l;
if (winner == 1) if (winner == 1)
...@@ -4316,7 +4314,7 @@ joust (cand1, cand2, warn) ...@@ -4316,7 +4314,7 @@ joust (cand1, cand2, warn)
cp_warning (" for conversion from `%T' to `%T'", cp_warning (" for conversion from `%T' to `%T'",
TREE_TYPE (source_type (TREE_VEC_ELT (w->convs, 0))), TREE_TYPE (source_type (TREE_VEC_ELT (w->convs, 0))),
TREE_TYPE (w->second_conv)); TREE_TYPE (w->second_conv));
cp_warning (" because conversion sequence for `this' argument is better"); cp_warning (" because conversion sequence for the argument is better");
} }
else else
add_warning (w, l); add_warning (w, l);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment