<div dir="ltr"><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">If I'm understanding your argument correctly, you're saying that if we allow pointer-to-bool in a conditional context because it is "tagged" by the context, then we can similarly argue that "return" tags the context? If so, I see your point, but "return" doesn't imply a bool type whereas the others do. So, it's different than an arbitrary expression context, but, IMO, not enough.</div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif"><br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">Still, this is all a matter of taste, so if you are willing to write the patch to add that configuration option, I'd think you'll get a fair consideration from reviewers.</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Sep 20, 2019 at 6:52 AM Simon Sandström <<a href="mailto:simon@nikanor.nu">simon@nikanor.nu</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On 18/09, Yitzhak Mandelbaum wrote:<br>
> In the second case, you're not using it in a condition context -- it's just<br>
> a normal boolean-valued expression. The flag only disables the check when<br>
> these implicit casts appear in the context of "conditions": if, while, for,<br>
> etc. Here's the relevant code:<br>
> <br>
> <a href="https://github.com/llvm/llvm-project/blob/master/clang-tools-extra/clang-tidy/readability/ImplicitBoolConversionCheck.cpp#L220" rel="noreferrer" target="_blank">https://github.com/llvm/llvm-project/blob/master/clang-tools-extra/clang-tidy/readability/ImplicitBoolConversionCheck.cpp#L220</a><br>
> <br>
> The documentation (<br>
> <a href="https://clang.llvm.org/extra/clang-tidy/checks/readability-implicit-bool-conversion.html" rel="noreferrer" target="_blank">https://clang.llvm.org/extra/clang-tidy/checks/readability-implicit-bool-conversion.html</a>)<br>
> could arguably use some clarification.<br>
> <br>
> On Sat, Sep 14, 2019 at 7:05 AM Simon Sandström via cfe-dev <<br>
> <a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a>> wrote:<br>
> <br>
<br>
Thank you, that explains it. Besides updating the documentation, do you<br>
think it would be useful to add a new option to allow implicit casts<br>
like in the second case? AllowPointerReturnStatement or whatever.<br>
<br>
Maybe there are other issues that can arise from implicitly casting<br>
pointer to bool in return statement that cannot happen in a condition<br>
context? Or it's just preferred to explicitly check against nullptr in a<br>
return statement?<br>
<br>
- Simon<br>
</blockquote></div>