Duplicate reports 3830, 4556 and 3747.
Jan van Dijk
jan@etpmod.phys.tue.nl
Tue Oct 16 02:45:00 GMT 2001
[Please CC me, thanks]
Hi there,
Somebody with GNATS write access should mark two of the PR's 3830, 4556
and 3747 as duplicates. They describe the same bug: gcc versions >= 3.0
refuse to compile the following correct code:
struct MyString
{
char operator[](unsigned) const;
operator const char*() const;
};
int main()
{
MyString s;
char c1 = s[0u]; // OK
char c2 = s[0]; // <=====
return 0;
};
The line <===== results in the error message:
test.cpp: In function `int main()':
test.cpp:11: choosing `char MyString::operator[](unsigned int) const'
over `
operator[]'
test.cpp:11: because worst conversion for the former is better than
worst
conversion for the latter
More information about the Gcc-bugs
mailing list