Thread View: gnu.g++.bug
1 messages
1 total messages
Started by "Douglas C. Schmidt"
Fri, 13 Jan 1989 03:34
G++ allows ambiguous overloading:
Author: "Douglas C. Schmidt"
Date: Fri, 13 Jan 1989 03:34
Date: Fri, 13 Jan 1989 03:34
49 lines
1375 bytes
1375 bytes
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
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads