This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Inappropriate Warning Cannot Be Turned Off


> 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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]