g++ 2.95.2 fails to detect ambiguity between member and non-member

Martin v. Loewis martin@loewis.home.cs.tu-berlin.de
Fri Mar 24 00:10:00 GMT 2000


> Hence, according to 13.3.3, p2, the call is ill-formed.

Thanks for your bug report. It' not a bug, it's a feature :-) With
-pedantic, g++ says

a.cc: In function `int main()':
a.cc:17: ambiguous overload for `!S'
a.cc:3: candidates are: int S::operator !() const
a.cc:10:                 int operator !(const S &)

To provide better compatibility with the ARM rules, g++ accepts code
which is pedantically ill-formed. This is designed as an extension,
i.e. the rules should never result well-formed code being interpreted
differently.

Regards,
Martin


More information about the Gcc-bugs mailing list