-
Notifications
You must be signed in to change notification settings - Fork 15.3k
Closed as not planned
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 analyzerinvalidResolved as invalid, i.e. not a bugResolved as invalid, i.e. not a bug
Description
// Type your code here, or load an example.
unsigned line() { return -1.0; }
unsigned square() { return static_cast<unsigned>(-1.0); }
unsigned cube() { return (unsigned)-1.0; }
unsigned tesseract() { double num = -1.0; return num; }Expected: All four compile to a single ret with -O2 (https://godbolt.org/z/h4vfe77qn), so I would quite like to see four warnings.
Actual: Only the first one warns.
edit: added one with static_cast because Someone™ on ms-stl discord doesn't like C casts
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 analyzerinvalidResolved as invalid, i.e. not a bugResolved as invalid, i.e. not a bug