schmidt%crimee.ics.uci.edu@PARIS.ICS.UCI.EDU ("Douglas C. Schmidt") (01/13/89)
Hi,
The following short C++ program contains an erroneous conversion,
according to cfront 1.2.1. It was taken from the article ``Building
Well-Behaved Type Relationships in C++'' by R.B. Murray.
----------------------------------------
class Orange {
public:
char *c;
operator int () {
return (int (c));
}
};
class Apple {
public:
int i;
Apple() {
}
Apple(Orange F) {
i = F;
}
};
overload cross;
void cross (Orange, Apple);
void cross (Apple, Apple);
main ( ) {
Orange Navel;
Apple Mac;
cross(Navel,Navel); // error: two possible conversions.
}
----------------------------------------
Here's the CC diagnostic:
----------------------------------------
CC test.c:
"test.c", line 27: error: ambiguous argument for overloaded cross()
1 error
----------------------------------------
g++ 1.32 doesn't complain, but should.
Doug