summaryrefslogtreecommitdiff
path: root/cui/source/tabpages/tpline.cxx
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2019-10-22 12:18:34 +0200
committerStephan Bergmann <sbergman@redhat.com>2019-10-22 16:57:30 +0200
commit54f292d1d199dae36257a1ceb0ff30f32a7e0824 (patch)
tree39f5857ffbee965212e2e6d4cf880279b885c2c5 /cui/source/tabpages/tpline.cxx
parent65b239f8cab7e5a82438a617d8d9e022fc441138 (diff)
Avoid C++20 operator overloading ambiguity
...which is reported now by Clang 10 trunk with -std=c++2a: > cui/source/tabpages/tpline.cxx:481:80: error: use of overloaded operator '==' is ambiguous (with operand types 'const XLineEndItem' and 'XLineStartItem') > if( pItem && ( !pOld || !( *static_cast<const XLineEndItem*>(pOld) == *pItem ) ) ) > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~~~~~~ > include/svx/xlnstit.hxx:43:29: note: candidate function (with reversed parameter order) > virtual bool operator==(const SfxPoolItem& rItem) const override; > ^ > include/svx/xlnedit.hxx:43:29: note: candidate function > virtual bool operator==(const SfxPoolItem& rItem) const override; > ^ But the base SfxPoolItem::operator == is virtual anyway, so no need to cast pOld to a derived type. And once the expression is changed to !( *pOld == *pItem ) loplugin:simplifybool would kick in, but only with old compilers. So update loplugin:simplifybool to also kick in on that with latest Clang trunk with -std=c++2a, and simplify the expression accordingly. Change-Id: I3de9175b30d8645ed7a52f87cfac320144576cc8 Reviewed-on: https://gerrit.libreoffice.org/81203 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'cui/source/tabpages/tpline.cxx')
-rw-r--r--cui/source/tabpages/tpline.cxx2
1 files changed, 1 insertions, 1 deletions
diff --git a/cui/source/tabpages/tpline.cxx b/cui/source/tabpages/tpline.cxx
index 3cc694a7ebc6..89fc0dc227ef 100644
--- a/cui/source/tabpages/tpline.cxx
+++ b/cui/source/tabpages/tpline.cxx
@@ -478,7 +478,7 @@ bool SvxLineTabPage::FillItemSet( SfxItemSet* rAttrs )
else if( m_pLineEndList->Count() > static_cast<long>( nPos - 1 ) )
pItem.reset(new XLineStartItem( m_xLbStartStyle->get_active_text(), m_pLineEndList->GetLineEnd( nPos - 1 )->GetLineEnd() ));
pOld = GetOldItem( *rAttrs, XATTR_LINESTART );
- if( pItem && ( !pOld || !( *static_cast<const XLineEndItem*>(pOld) == *pItem ) ) )
+ if( pItem && ( !pOld || *pOld != *pItem ) )
{
rAttrs->Put( *pItem );
bModified = true;