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
On Wed, Sep 19, 2018 at 3:44 PM, Marek Polacek <polacek@redhat.com> wrote:
> 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.
And that's what the documentation should say, rather than the vague "wrong".
Jason