forked from OSchip/llvm-project
[clang-tidy] Fix assertion when a dependent expression is used in an assert.
llvm-svn: 231620
This commit is contained in:
parent
7a3cbb2997
commit
b2ddb8ac4d
|
@ -69,7 +69,9 @@ void StaticAssertCheck::check(const MatchFinder::MatchResult &Result) {
|
|||
StringRef MacroName =
|
||||
Lexer::getImmediateMacroName(AssertExpansionLoc, SM, Opts);
|
||||
|
||||
if (MacroName != "assert" || !Condition->isEvaluatable(*ASTCtx))
|
||||
if (MacroName != "assert" || Condition->isValueDependent() ||
|
||||
Condition->isTypeDependent() || Condition->isInstantiationDependent() ||
|
||||
!Condition->isEvaluatable(*ASTCtx))
|
||||
return;
|
||||
|
||||
// False literal is not the result of macro expansion.
|
||||
|
|
|
@ -34,6 +34,8 @@ template <class T> void doSomething(T t) {
|
|||
|
||||
assert(t.method());
|
||||
// CHECK-FIXES: {{^ }}assert(t.method());
|
||||
|
||||
assert(sizeof(T) == 123);
|
||||
}
|
||||
|
||||
int main() {
|
||||
|
|
Loading…
Reference in New Issue