Question about operator = overloaded in reportdesign module

Markus Mohrhard markus.mohrhard at
Sun Dec 30 12:48:36 PST 2012


> 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).

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.


More information about the LibreOffice mailing list