From: Chris Lattner Date: Tue, 11 Dec 2007 23:11:17 +0000 (+0000) Subject: Fix a case where we'd return "is not a constant expr" without X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=239c15e5b07a6cc84278ede87edf638922767520;p=clang Fix a case where we'd return "is not a constant expr" without return a location. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44889 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/AST/Expr.cpp b/AST/Expr.cpp index 545ebd8e18..c6a6ab3601 100644 --- a/AST/Expr.cpp +++ b/AST/Expr.cpp @@ -443,8 +443,13 @@ bool Expr::isConstantExpr(ASTContext &Ctx, SourceLocation *Loc) const { const UnaryOperator *Exp = cast(this); // C99 6.6p9 - if (Exp->getOpcode() == UnaryOperator::AddrOf) - return Exp->getSubExpr()->hasStaticStorage(); + if (Exp->getOpcode() == UnaryOperator::AddrOf) { + if (!Exp->getSubExpr()->hasStaticStorage()) { + if (Loc) *Loc = getLocStart(); + return false; + } + return true; + } // Get the operand value. If this is sizeof/alignof, do not evalute the // operand. This affects C99 6.6p3.