Index: clang-tidy/bugprone/MisplacedWideningCastCheck.cpp =================================================================== --- clang-tidy/bugprone/MisplacedWideningCastCheck.cpp +++ clang-tidy/bugprone/MisplacedWideningCastCheck.cpp @@ -213,8 +213,9 @@ dyn_cast(CastType->getUnqualifiedDesugaredType()); const auto *CalcBuiltinType = dyn_cast(CalcType->getUnqualifiedDesugaredType()); - if (CastBuiltinType && CalcBuiltinType && - !isFirstWider(CastBuiltinType->getKind(), CalcBuiltinType->getKind())) + if (!CastBuiltinType || !CalcBuiltinType) + return; + if (!isFirstWider(CastBuiltinType->getKind(), CalcBuiltinType->getKind())) return; } Index: test/clang-tidy/bugprone-misplaced-widening-cast-explicit-only.cpp =================================================================== --- test/clang-tidy/bugprone-misplaced-widening-cast-explicit-only.cpp +++ test/clang-tidy/bugprone-misplaced-widening-cast-explicit-only.cpp @@ -62,3 +62,21 @@ enum Type {}; static char *m_fn1() { char p = (Type)(&p - m_fn1()); } }; + +enum DaysEnum { + MON, + TUE, + WED, + THR, + FRI, + SAT, + SUN +}; + +// Do not warn for int to enum casts. +void nextDay(DaysEnum day) { + if (day < SUN) + day = (DaysEnum)(day + 1); + if (day < SUN) + day = static_cast(day + 1); +}