From 44753f7cf05f502e566fe97231883a047d1f120a Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Wed, 25 Mar 2015 21:37:48 +0100 Subject: Expr::EvaluateAs... does not work for type-dependent expressions Change-Id: Iea1cd468528d00ffa07e13b2063ca5fce5cc4fae --- compilerplugins/clang/constantfunction.cxx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'compilerplugins') 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; } -- cgit