From 9daa4e60a47b30241981316e808e4c8189eed17b Mon Sep 17 00:00:00 2001 From: Alexandre Duret-Lutz Date: Fri, 17 Jul 2020 11:39:55 +0200 Subject: [PATCH] formula: make operator bool explicit * spot/tl/formula.hh (formula::operator bool): Make it explicit. When compiling in C++20 mode with g++ 10.1, this bool operator was used instead of the comparison operators while looking up a std::pair in a hash map, causing many test suite failures. This problem does not occur with clang++ 10.0, so it might just be a bug in g++ 10.1. But having explicit operator bool is good practice anyway. --- spot/tl/formula.hh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spot/tl/formula.hh b/spot/tl/formula.hh index 57cc8f91c..f355a4d23 100644 --- a/spot/tl/formula.hh +++ b/spot/tl/formula.hh @@ -842,7 +842,7 @@ namespace spot return ptr_ != nullptr; } - operator bool() const noexcept + explicit operator bool() const noexcept { return ptr_ != nullptr; }