call.c (build_user_type_conversion_1): Don't set ICS_BAD_FLAG on an ambiguous conversion.

* call.c (build_user_type_conversion_1): Don't set ICS_BAD_FLAG on
        an ambiguous conversion.

From-SVN: r59775
This commit is contained in:
Jason Merrill 2002-12-03 12:29:43 -05:00 committed by Jason Merrill
parent 491a977722
commit c203334d6d
6 changed files with 36 additions and 5 deletions

View File

@ -1,3 +1,8 @@
2002-12-03 Jason Merrill <jason@redhat.com>
* call.c (build_user_type_conversion_1): Don't set ICS_BAD_FLAG on
an ambiguous conversion.
2002-12-03 Mark Mitchell <mark@codesourcery.com>
PR c++/8688

View File

@ -2620,7 +2620,8 @@ build_user_type_conversion_1 (totype, expr, flags)
cand = candidates; /* any one will do */
cand->second_conv = build1 (AMBIG_CONV, totype, expr);
ICS_USER_FLAG (cand->second_conv) = 1;
ICS_BAD_FLAG (cand->second_conv) = 1;
/* Don't set ICS_BAD_FLAG; an ambiguous conversion is no worse than
another user-defined conversion. */
return cand;
}

View File

@ -0,0 +1,23 @@
// [over.best.ics]: For the purpose of ranking implicit conversion
// sequences as described in _over.ics.rank_, the ambiguous conversion
// sequence is treated as a user-defined sequence that is indistinguishable
// from any other user- defined conversion sequence.
struct A
{
A(long);
A(char);
};
struct B
{
B(int);
};
void f(A); // { dg-error "" "candidate" }
void f(B); // { dg-error "" "candidate" }
int main()
{
f (42); // { dg-error "ambiguous" "ambiguous" }
}

View File

@ -15,7 +15,7 @@ typedef unsigned long uint_32;
class sanjose {
public:
sanjose();
sanjose(const sanjose&);
sanjose(const sanjose&); // ERROR - candidate
sanjose(int_8 value); // ERROR - // ERROR -
sanjose(uint_32 value); // ERROR - // ERROR -
};

View File

@ -7,13 +7,15 @@
// the explicit cast syntax disambiguates the constructor as one which
// invokes the type conversion operator rather than the conversion.
// NO, IT DOESN'T. It's still ambiguous. --jason 2002-12-03
// cfront 2.0 passes this test.
// keywords: user-defined type conversion operator, constructor
struct t_0_st_0;
struct t_0_st_1 { // ERROR -
struct t_0_st_1 {
int member;
t_0_st_1 (t_0_st_0&);// ERROR -
@ -80,7 +82,7 @@ void t_1_local_init ()
struct t_2_st_0;
struct t_2_st_1 { // ERROR - candidate
struct t_2_st_1 {
int member;
t_2_st_1 (t_2_st_0); // ERROR - candidate

View File

@ -3,7 +3,7 @@
class B;
class A {
class A { // ERROR - copy ctor candidate
private:
A(B *); // ERROR -
public: