-
Notifications
You must be signed in to change notification settings - Fork 15.2k
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 analyzerenhancementImproving things as opposed to bug fixing, e.g. new or missing featureImproving things as opposed to bug fixing, e.g. new or missing featurefalse-negativeWarning doesn't fire when it shouldWarning doesn't fire when it shouldquality-of-implementation
Description
For the code below clang should emit 2 unreachable code warnings, but it only emits one
https://godbolt.org/z/fT9rs5xYn
#include <type_traits>
[[noreturn]] void crash() noexcept;
#define VerifyElseCrash(b) \
if (!b) [[unlikely]] { \
crash(); \
}
void some_other_funtion();
int f1() {
if (!false) [[unlikely]] {
crash();
}
some_other_funtion(); // dead code
}
int f2() {
VerifyElseCrash(false);
some_other_funtion(); // dead code
}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 analyzerenhancementImproving things as opposed to bug fixing, e.g. new or missing featureImproving things as opposed to bug fixing, e.g. new or missing featurefalse-negativeWarning doesn't fire when it shouldWarning doesn't fire when it shouldquality-of-implementation