+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
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;
}
--- /dev/null
+// [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" }
+}
class sanjose {
public:
sanjose();
- sanjose(const sanjose&);
+ sanjose(const sanjose&); // ERROR - candidate
sanjose(int_8 value); // ERROR - // ERROR -
sanjose(uint_32 value); // ERROR - // ERROR -
};
// 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 -
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
class B;
-class A {
+class A { // ERROR - copy ctor candidate
private:
A(B *); // ERROR -
public: