No warning for implicit narrowing conversion during constant evaluation #92656
Labels
clang:diagnostics
New/improved warning or error message in Clang, but not in clang-tidy or static analyzer
false-negative
The fixes for C++23 P2564 merged by #89565 expanded the class of constant evaluated variable initializers. This inadvertently resulted in some warnings no longer diagnosing, e.g.,
A suggested approach is to mark both diagnoses of
warn_impcast_integer_precision_constant
asDiagRuntimeBehavior
(which was previously the case), and to separately diagnose in the constant evaluator. This could be done by deducing narrowing during evaluation, or by marking narrowing expressions during semantic analysis and thereafter diagnosing if any such expressions are evaluated. Ideally, the above would diagnose, but an initializer like the following would not:The text was updated successfully, but these errors were encountered: