[clang-tidy] Fix assertion when a dependent expression is used in an assert.

llvm-svn: 231620
This commit is contained in:
Alexander Kornienko 2015-03-09 02:27:57 +00:00
parent 7a3cbb2997
commit b2ddb8ac4d
2 changed files with 5 additions and 1 deletions

View File

@ -69,7 +69,9 @@ void StaticAssertCheck::check(const MatchFinder::MatchResult &Result) {
StringRef MacroName = StringRef MacroName =
Lexer::getImmediateMacroName(AssertExpansionLoc, SM, Opts); Lexer::getImmediateMacroName(AssertExpansionLoc, SM, Opts);
if (MacroName != "assert" || !Condition->isEvaluatable(*ASTCtx)) if (MacroName != "assert" || Condition->isValueDependent() ||
Condition->isTypeDependent() || Condition->isInstantiationDependent() ||
!Condition->isEvaluatable(*ASTCtx))
return; return;
// False literal is not the result of macro expansion. // False literal is not the result of macro expansion.

View File

@ -34,6 +34,8 @@ template <class T> void doSomething(T t) {
assert(t.method()); assert(t.method());
// CHECK-FIXES: {{^ }}assert(t.method()); // CHECK-FIXES: {{^ }}assert(t.method());
assert(sizeof(T) == 123);
} }
int main() { int main() {