Index: clang-tools-extra/trunk/clang-tidy/misc/MisplacedWideningCastCheck.cpp =================================================================== --- clang-tools-extra/trunk/clang-tidy/misc/MisplacedWideningCastCheck.cpp +++ clang-tools-extra/trunk/clang-tidy/misc/MisplacedWideningCastCheck.cpp @@ -192,6 +192,10 @@ if (Calc->getLocStart().isMacroID()) return; + if (Cast->isTypeDependent() || Cast->isValueDependent() || + Calc->isTypeDependent() || Calc->isValueDependent()) + return; + ASTContext &Context = *Result.Context; QualType CastType = Cast->getType(); Index: clang-tools-extra/trunk/test/clang-tidy/misc-misplaced-widening-cast-explicit-only.cpp =================================================================== --- clang-tools-extra/trunk/test/clang-tidy/misc-misplaced-widening-cast-explicit-only.cpp +++ clang-tools-extra/trunk/test/clang-tidy/misc-misplaced-widening-cast-explicit-only.cpp @@ -56,3 +56,9 @@ return (long)a * 1000; } } + +// Shall not generate an assert. https://bugs.llvm.org/show_bug.cgi?id=33660 +template class A { + enum Type {}; + static char *m_fn1() { char p = (Type)(&p - m_fn1()); } +};