This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: C++ PATCH to add -Wclass-conversion
- From: Marek Polacek <polacek at redhat dot com>
- To: Florian Weimer <fweimer at redhat dot com>
- Cc: Jason Merrill <jason at redhat dot com>, GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Wed, 19 Sep 2018 15:44:30 -0400
- Subject: Re: C++ PATCH to add -Wclass-conversion
- References: <20180919193439.GQ5587@redhat.com> <87d0t946p6.fsf@oldenburg.str.redhat.com>
On Wed, Sep 19, 2018 at 09:40:05PM +0200, Florian Weimer wrote:
> Marek Polacek <polacek@redhat.com> writes:
>
> > +@item -Wno-class-conversion @r{(C++ and Objective-C++ only)}
> > +@opindex Wno-class-conversion
> > +@opindex Wclass-conversion
> > +Disable the warning about user-defined conversions converting a class to
> > +the wrong type, such as having a conversion function converting an
> > +object to the same type, to a base class of that type, or to void.
> > @end table
>
> I'm not sure if “the wrong type” is correct in this context because
> there is no single wrong type here.
Maybe "to *a* wrong type" then.
> What's the actual problem? That the user-defined conversion operator
> will never be called?
That such a conversion function will never be called, yes.
Marek