-
Notifications
You must be signed in to change notification settings - Fork 14.8k
Open
Labels
clang:diagnosticsNew/improved warning or error message in Clang, but not in clang-tidy or static analyzerNew/improved warning or error message in Clang, but not in clang-tidy or static analyzerfalse-negativeWarning doesn't fire when it shouldWarning doesn't fire when it should
Description
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.,
constexpr char h = u'\u5678'; // previously diagnosed warn_impcast_integer_precision_constant
A suggested approach is to mark both diagnoses of warn_impcast_integer_precision_constant
as DiagRuntimeBehavior
(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:
constexpr char h = (true ? 'a' : u'\u5678');
Metadata
Metadata
Assignees
Labels
clang:diagnosticsNew/improved warning or error message in Clang, but not in clang-tidy or static analyzerNew/improved warning or error message in Clang, but not in clang-tidy or static analyzerfalse-negativeWarning doesn't fire when it shouldWarning doesn't fire when it should