compilerplugins/clang/getstr.cxx | 1 - sd/inc/OutlinerIterator.hxx | 4 ++-- sd/source/ui/view/OutlinerIterator.cxx | 4 ++-- 3 files changed, 4 insertions(+), 5 deletions(-)
New commits: commit 41147e20029c80c4941ca81bc5dca3782bef5d94 Author: Stephan Bergmann <sberg...@redhat.com> AuthorDate: Mon Oct 21 22:12:06 2019 +0200 Commit: Stephan Bergmann <sberg...@redhat.com> CommitDate: Tue Oct 22 07:19:03 2019 +0200 Make comparison operator member functions const ...which avoids overload resolution ambiguities in C++20, when a synthesized candidate of operator == for a reversed-argument rewrite conflicts with the actual operator ==, due to the asymmetric const-ness of the implicit object parameter and the RHS parameter. (As observed with recent Clang 10 trunk with -std=c++2a: > sd/source/ui/view/Outliner.cxx:543:44: error: use of overloaded operator '!=' is ambiguous (with operand types '::sd::outliner::Iterator' and 'sd::outliner::Iterator') > mbMatchMayExist = (maObjectIterator!=sd::outliner::OutlinerContainer(this).begin()); > ~~~~~~~~~~~~~~~~^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > sd/inc/OutlinerIterator.hxx:133:10: note: candidate function > bool operator!= (const Iterator& rIterator); > ^ > sd/inc/OutlinerIterator.hxx:125:10: note: candidate function > bool operator== (const Iterator& rIterator); > ^ > sd/inc/OutlinerIterator.hxx:125:10: note: candidate function (with reversed parameter order) ) Change-Id: Ia477f3f9cf19a5ae0e15a4536d70924962098ce4 Reviewed-on: https://gerrit.libreoffice.org/81280 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sberg...@redhat.com> diff --git a/sd/inc/OutlinerIterator.hxx b/sd/inc/OutlinerIterator.hxx index dcc8238d4271..e78e9447d506 100644 --- a/sd/inc/OutlinerIterator.hxx +++ b/sd/inc/OutlinerIterator.hxx @@ -122,7 +122,7 @@ public: @return Returns <TRUE/> when both iterators point to the same object. */ - bool operator== (const Iterator& rIterator); + bool operator== (const Iterator& rIterator) const; /** Test whether two iterators point to different objects. This is just the negation of the result of the equality operator. @param rIterator @@ -130,7 +130,7 @@ public: @return Returns <TRUE/> when both iterators point to the different objects. */ - bool operator!= (const Iterator& rIterator); + bool operator!= (const Iterator& rIterator) const; /** Reverse the direction of iteration. The position of the iterator is not changed. Thus calling this method twice returns to the old state. */ diff --git a/sd/source/ui/view/OutlinerIterator.cxx b/sd/source/ui/view/OutlinerIterator.cxx index aa7bb51b1184..b91e6de9640c 100644 --- a/sd/source/ui/view/OutlinerIterator.cxx +++ b/sd/source/ui/view/OutlinerIterator.cxx @@ -104,7 +104,7 @@ Iterator& Iterator::operator++ () return *this; } -bool Iterator::operator== (const Iterator& rIterator) +bool Iterator::operator== (const Iterator& rIterator) const { if (!mxIterator || !rIterator.mxIterator) return mxIterator.get() == rIterator.mxIterator.get(); @@ -112,7 +112,7 @@ bool Iterator::operator== (const Iterator& rIterator) return *mxIterator == *rIterator.mxIterator; } -bool Iterator::operator!= (const Iterator& rIterator) +bool Iterator::operator!= (const Iterator& rIterator) const { return ! operator==(rIterator); } commit 20c6dfde1dff22de7d38ecea00bcf75aa21a1694 Author: Stephan Bergmann <sberg...@redhat.com> AuthorDate: Mon Oct 21 19:27:12 2019 +0200 Commit: Stephan Bergmann <sberg...@redhat.com> CommitDate: Tue Oct 22 07:18:49 2019 +0200 There doesn't need to be a TemplateSpecializationType here On both macOS (libc++) and Windows (MSVC standard library), compilerplugins/clang/test/getstr.cxx failed four tests without this fix: > error: 'error' diagnostics expected but not seen: > File compilerplugins/clang/test/getstr.cxx Line 29: suspicious use of 'getStr' on an object of type 'rtl::OUStringBuffer'; the result is implicitly cast to a void pointer in a call of 'operator <<' [loplugin:getstr] > File compilerplugins/clang/test/getstr.cxx Line 30: directly use object of type 'S' (aka 'rtl::OString') in a call of 'operator <<', instead of calling 'getStr' first [loplugin:getstr] > File compilerplugins/clang/test/getstr.cxx Line 34: suspicious use of 'getStr' on an object of type 'rtl::OUStringBuffer'; the result is implicitly cast to a void pointer in a call of 'operator <<' [loplugin:getstr] > File compilerplugins/clang/test/getstr.cxx Line 35: directly use object of type 'rtl::OString' in a call of 'operator <<', instead of calling 'getStr' first [loplugin:getstr] Change-Id: I65406d3d84bb5a89df44c8fd665b6e38d19f38c7 Reviewed-on: https://gerrit.libreoffice.org/81266 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sberg...@redhat.com> diff --git a/compilerplugins/clang/getstr.cxx b/compilerplugins/clang/getstr.cxx index 15f340296bea..aba53bd6e2e5 100644 --- a/compilerplugins/clang/getstr.cxx +++ b/compilerplugins/clang/getstr.cxx @@ -70,7 +70,6 @@ public: } assert(expr->getNumArgs() == 2); if (!loplugin::TypeCheck(expr->getArg(0)->getType()) - .TemplateSpecializationClass() .ClassOrStruct("basic_ostream") .StdNamespace()) //TODO: check template args { _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits