From 324f5a14d7cfb4922a0345d67b20b8cb5953ee82 Mon Sep 17 00:00:00 2001 From: David Blaikie Date: Thu, 26 Mar 2020 13:47:34 -0700 Subject: [PATCH] Make llvm::function_ref's operator bool explicit This can avoid all sorts of mistakes with implicit conversion (indirectly) to int, etc. I'm quite surprise there aren't any things to fixup with this - but I guess most uses of function_ref aren't optional/nullable. --- llvm/include/llvm/ADT/STLExtras.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/llvm/include/llvm/ADT/STLExtras.h b/llvm/include/llvm/ADT/STLExtras.h index 638895e..ad1150b 100644 --- a/llvm/include/llvm/ADT/STLExtras.h +++ b/llvm/include/llvm/ADT/STLExtras.h @@ -124,7 +124,7 @@ public: return callback(callable, std::forward(params)...); } - operator bool() const { return callback; } + explicit operator bool() const { return callback; } }; // deleter - Very very very simple method that is used to invoke operator -- 2.7.4