erichkeane wrote:

> > I can't for the life of me see a good way to use this. The `if(p)` pattern 
> > is so common that no code base could ever turn on this warning. We could 
> > PERHAPS check that we're in the process of checking a condition expression 
> > and suppress this diagnostic, or recognize this pattern somehow, but 
> > without some more work to make this more useful, I don't think we can 
> > accept this diagnostic.
> 
> Given the amount of existing code out there which relies on pointer-to-bool 
> conversions being well-defined, I don't think this makes sense as a compiler 
> diagnostic. However, it could be a reasonable clang-tidy check as there are 
> folks who find such code to be a type safety issue and they might want to 
> have it diagnosed.

I find myself wondering if there is value/ability to just pattern match the 
operator= for a `bool` to see if it has said implicit/explicit casts on the 
RHS.  We unfortunately have to do this in something that handles the operator=, 
instead of the casts themselves (which are too ubiquitous to diagnose), but we 
should still be able to pattern-match this.

https://github.com/llvm/llvm-project/pull/131523
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to