[SOLVED] Re: Question about operator = overloaded in reportdesign module

Julien Nabet serval2412 at yahoo.fr
Sun Dec 30 12:58:30 PST 2012


On 30/12/2012 21:48, Markus Mohrhard wrote:
> Hey,
>
>
>> Cppcheck reported this:
>> [reportdesign/source/filter/xml/xmlComponent.hxx:37]: (style)
>> 'OXMLComponent::operator=' should return 'OXMLComponent&'.
>> [reportdesign/source/filter/xml/xmlFunction.hxx:41]: (style)
>> 'OXMLFunction::operator=' should return 'OXMLFunction&'.
>> [reportdesign/source/filter/xml/xmlGroup.hxx:38]: (style)
>> 'OXMLGroup::operator=' should return 'OXMLGroup&'.
>> [reportdesign/source/filter/xml/xmlCell.hxx:41]: (style)
>> 'OXMLCell::operator=' should return 'OXMLCell&'.
>>
>> By trying to fix these, I noticed that none of them was implemented. So can
>> they just be removed, is it another C++ "trick", or something obvious I
>> missed?
>>
> You can't remove them. They are declared there to prevent the default
> operator= and copy c'tor. If you don't declare them private and leave
> out the implementation the compiler will generate a default operator=
> (the same is true for the copy c'tor).
I didn't think that one's want prevent default behaviour without 
overloading but since it was on purpose, ok for me.
>
> But you can of course change the signature of the operator even when
> it does not matter in that case as these will not be implemented.
Ok done, see 
http://cgit.freedesktop.org/libreoffice/core/commit/?id=c183d8c0cdc849673bee180f780604700eac85fb

Thank you again Markus.

Julien



More information about the LibreOffice mailing list