[clang-tools-extra] r320591 - [clangd] Fix bool conversion operator of UniqueFunction

David Blaikie via cfe-commits cfe-commits at lists.llvm.org
Mon Dec 18 10:25:15 PST 2017


This operator bool should probably be explicit (as most/all of them should
be - and most of them in LLVM are) - to avoid undue implicit conversion to
other int types.

On Wed, Dec 13, 2017 at 7:43 AM Ilya Biryukov via cfe-commits <
cfe-commits at lists.llvm.org> wrote:

> Author: ibiryukov
> Date: Wed Dec 13 07:42:59 2017
> New Revision: 320591
>
> URL: http://llvm.org/viewvc/llvm-project?rev=320591&view=rev
> Log:
> [clangd] Fix bool conversion operator of UniqueFunction
>
> Usages of it were giving compiler errors because of the missing
> explicit conversion.
>
> Modified:
>     clang-tools-extra/trunk/clangd/Function.h
>
> Modified: clang-tools-extra/trunk/clangd/Function.h
> URL:
> http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/Function.h?rev=320591&r1=320590&r2=320591&view=diff
>
> ==============================================================================
> --- clang-tools-extra/trunk/clangd/Function.h (original)
> +++ clang-tools-extra/trunk/clangd/Function.h Wed Dec 13 07:42:59 2017
> @@ -49,7 +49,7 @@ public:
>                      FunctionCallImpl<typename
> std::decay<Callable>::type>>(
>              std::forward<Callable>(Func))) {}
>
> -  operator bool() { return CallablePtr; }
> +  operator bool() { return bool(CallablePtr); }
>
>    Ret operator()(Args... As) {
>      assert(CallablePtr);
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20171218/ce890935/attachment.html>


More information about the cfe-commits mailing list