Inappropriate Warning Cannot Be Turned Off
Martin v. Loewis
martin@loewis.home.cs.tu-berlin.de
Tue Jun 6 00:14:00 GMT 2000
> I don't know what the ISO C++ standard has to say on this subject and if a
> diagnostic is needed, I'll have to leave that to Martin. But IMO these aren't
> inappropriate, because they point out possibly unwanted behaviour (Martin?).
>
> I'd agree with you though that there should be a switch to inhibit the
> warning (that is, if a diagnostic isn't required).
The code is correct, but the ISO rules are confusing; this comes from
call.c
/* warn about confusing overload resolution for user-defined conversions,
either between a constructor and a conversion op, or between two
conversion ops. */
You'd have to ask Jason for the exact rationale why there is no option
to turn it off. We had *many* bug reports where people claimed that
the compiler did the wrong thing, when in fact there understanding of
C++ was wrong. Without the warning, they even would not have known
that that the compiler did not what they expected. So overall, I'd say
this feature has proven useful. In many cases, it is possible to
adjust the code by adding a third conversion operator.
Regards,
Martin
More information about the Gcc-bugs
mailing list