[clang] [Clang][Sema]: Diagnose lambda to bool implicit casts (PR #83152)

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Wed Feb 28 04:35:15 PST 2024


AaronBallman wrote:

> > There are some related test failures caught by precommit CI that need to be addressed.
> > The issue in dr18xx.cpp looks to be a case where we should replace `bool b = ` with `auto b = ` (it doesn't change the testing for what's discussed in http://wg21.link/cwg1837).
> 
> Changing `bool b = ` to `auto b =` does not compile, as the compiler complains that `auto` is not allowed in non-static struct members. `b` cannot be declared as `static` either, which would cause an invalid use of `this` outside of a non-static member function. It looks like type deduction using auto for member variables is not allowed.

Yeah, another think-o on my part. I think it's fine to add the expected diagnostic to the file instead of silencing the warning.

https://github.com/llvm/llvm-project/pull/83152


More information about the cfe-commits mailing list