[PATCH] D155064: [clang][SemaCXX] Diagnose tautological uses of consteval if and is_constant_evaluated

Corentin Jabot via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Jul 22 02:25:29 PDT 2023


cor3ntin added a comment.

In D155064#4523024 <https://reviews.llvm.org/D155064#4523024>, @hazohelet wrote:

> In D155064#4514893 <https://reviews.llvm.org/D155064#4514893>, @cor3ntin wrote:
>
>> This looks good to me modulo nitpicks. 
>> When you land that, please make an issue on github for the missing narrowing warning, it seems important.
>>
>> I'll wait before approving in case @aaron.ballman spot things i missed
>
> I've already prepared another patch to fix the narrowing issue. Should I add the diff to this patch or open another revision?

I think merging the two patches would make sense, yes, that way we avoid regressions

> FWIW, I believe `const bool c = std::is_constant_evaluated();` this particular case should also be diagnosed because it could be a common mistake as was mentioned in https://github.com/llvm/llvm-project/issues/43760#issuecomment-981022686.

i think this is less pressing. doing that later (ie, for clang 18) is more reasonable. There are probably some interesting edge cases with constant initialization


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D155064/new/

https://reviews.llvm.org/D155064



More information about the cfe-commits mailing list