compilerplugins/clang/test/consttobool.cxx | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)
New commits: commit 4c13e89d8ef6f1eed1952fbca7ae1476d0ccff65 Author: Stephan Bergmann <sberg...@redhat.com> AuthorDate: Sun Feb 16 15:04:59 2020 +0100 Commit: Stephan Bergmann <sberg...@redhat.com> CommitDate: Sun Feb 16 16:29:41 2020 +0100 Fix compilerplugins/clang/test/consttobool.cxx ...after <https://github.com/llvm/llvm-project/commit/ 9ce6dc9872be4081fb98f6161c28581e1cbbe7dc> "CWG1423: don't permit implicit conversion of nullptr_t to bool." (Direct-initialization from std::nullptr_t to bool is allowed in C++17, but it appears that will be dropped from C++20, see <https://github.com/cplusplus/draft/commit/ df3e38121431afd9adcf7dce725a670a235463ea> "CWG1781 Converting from nullptr_t to bool in overload resolution", at which point the new check for initialization of S::b and the res.isNullPointer() branch in ConstToBool::VisitImplicitCastExpr, compilerplugins/clang/consttobool.cxx, will probably become moot.) Change-Id: I99773d13d514d5ba5296843592b740ea949b2b1f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88784 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sberg...@redhat.com> diff --git a/compilerplugins/clang/test/consttobool.cxx b/compilerplugins/clang/test/consttobool.cxx index 684a9739b2ab..28184825556e 100644 --- a/compilerplugins/clang/test/consttobool.cxx +++ b/compilerplugins/clang/test/consttobool.cxx @@ -25,6 +25,16 @@ enum E int const c1 = 1; constexpr int c2 = 2; +struct S +{ + S() + // expected-error-re@+1 {{implicit conversion of constant {{nullptr|0}} of type 'nullptr_t' to 'bool'; use 'false' instead [loplugin:consttobool]}} + : b(nullptr) + { + } + bool b; +}; + int main() { bool b; @@ -32,8 +42,6 @@ int main() b = 0; // expected-error@+1 {{implicit conversion of constant 1 of type 'sal_Bool' (aka 'unsigned char') to 'bool'; use 'true' instead [loplugin:consttobool]}} b = sal_True; - // expected-error-re@+1 {{implicit conversion of constant {{nullptr|0}} of type 'nullptr_t' to 'bool'; use 'false' instead [loplugin:consttobool]}} - b = nullptr; // expected-error@+1 {{implicit conversion of constant 1.000000e+00 of type 'double' to 'bool'; use 'true' instead [loplugin:consttobool]}} b = 1.0; // expected-error@+1 {{implicit conversion of constant 2 of type 'E' to 'bool'; use 'true' instead [loplugin:consttobool]}} _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits