[libcxx-commits] [libcxx] [libc++] Re-introduce special support for narrowing conversions to bool in variant (PR #73121)

via libcxx-commits libcxx-commits at lists.llvm.org
Wed Nov 29 14:15:50 PST 2023


EricWF wrote:

> Observe that the rightmost column is the only one with no sad faces.

Because you made the column. Not accepting `float v = 0.0;` is pretty sad. So is failing to accept `0` for `unsigned`. 

I'm pretty sure Google will be able to handle the revert here sooner rather than later. We'll just want to *always* enable the narrowing check for boolean. 

When I surveyed the Google code base a few years ago, bool was the only type that caused surprising conversion behavior. Every other "narrowing" conversion was either a literal, or obviously what the developer intended. Bool was the only type which caused a problem.

The reason Google (read EricWF) was so willing to punt on this issue is that it was a moving target. There are four columns in the table, which is a lot of times to get broken while the committee makes up their mind. 





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


More information about the libcxx-commits mailing list