diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2015-03-25 21:37:48 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2015-03-25 21:37:48 +0100 |
commit | 44753f7cf05f502e566fe97231883a047d1f120a (patch) | |
tree | 8f50a79efba43666fe37b82a83fdebe2a0324262 /compilerplugins | |
parent | ca5ff4559726455d0c8fbdd08cb35af3308492bf (diff) |
Expr::EvaluateAs... does not work for type-dependent expressions
Change-Id: Iea1cd468528d00ffa07e13b2063ca5fce5cc4fae
Diffstat (limited to 'compilerplugins')
-rw-r--r-- | compilerplugins/clang/constantfunction.cxx | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/compilerplugins/clang/constantfunction.cxx b/compilerplugins/clang/constantfunction.cxx index 49a2c10f299d..c3cd2b43bf73 100644 --- a/compilerplugins/clang/constantfunction.cxx +++ b/compilerplugins/clang/constantfunction.cxx @@ -450,8 +450,9 @@ bool ConstantFunction::VisitFunctionDecl(const FunctionDecl * pFunctionDecl) { // && !pReturnStmt->getRetValue()->isEvaluatable(compiler.getASTContext())) { bool aBoolResult; llvm::APSInt aIntResult; - if (!pReturnStmt->getRetValue()->EvaluateAsBooleanCondition(aBoolResult, compiler.getASTContext()) - && !pReturnStmt->getRetValue()->EvaluateAsInt(aIntResult, compiler.getASTContext())) + if (pReturnStmt->getRetValue()->isTypeDependent() + || (!pReturnStmt->getRetValue()->EvaluateAsBooleanCondition(aBoolResult, compiler.getASTContext()) + && !pReturnStmt->getRetValue()->EvaluateAsInt(aIntResult, compiler.getASTContext()))) { return true; } |