C++ conversion rules ???

Alexandre Oliva oliva@dcc.unicamp.br
Wed Jun 23 01:10:00 GMT 1999


On Jun 23, 1999, Jason Merrill <jason@cygnus.com> wrote:

>>>>>> Alexandre Oliva <oliva@dcc.unicamp.br> writes:
>> IMO, requiring the user to change his code, either by adding an
>> explicit cast or an additional conversion operator, just to avoid this
>> warning, is a very bad move.

>>> Jason, can we please disable the warning, or make it conditional on a
>>> flag?

>> I vote for simply disabling it.  Ok to install?

> No.  The warning is important; if your class has a conversion op that
> converts to a type A, and another op which converts to type B which can
> convert to A, you would expect that a cast to A would call the A operator.

I see.  It would be cool if we could guess the user expectations and
just print the warning when they'd be violated, but it seems to me
that this warning gets too many false positives, so it should not be
enabled by default.  Although this warning would save us from some
bogus bug reports, it would annoy too many people that know what
they're doing, and don't have to be taught C++.  Who should we
privilege?  

How about printing the warning for -W and/or for -Wcast-qual (since
the warning seems to only come up when cv-qualification is involved)?

-- 
Alexandre Oliva http://www.dcc.unicamp.br/~oliva IC-Unicamp, Bra[sz]il
{oliva,Alexandre.Oliva}@dcc.unicamp.br  aoliva@{acm.org,computer.org}
oliva@{gnu.org,kaffe.org,{egcs,sourceware}.cygnus.com,samba.org}
*** E-mail about software projects will be forwarded to mailing lists



More information about the Gcc-bugs mailing list