From c71d08bc22ae12755afb4d65bc33852e4dba7355 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Sat, 25 Apr 2009 21:59:05 +0000 Subject: fix PR4073 by making designated initializer checking code use VerifyIntegerConstantExpression instead of isIntegerConstantExpr. This makes it ext-warn but tolerate things that fold to a constant but that are not valid i-c-e's. There must be a bug in the i-c-e computation though, because it doesn't catch this case even with pedantic. This also switches the later code to use EvaluateAsInt which is simpler and handles everything that evaluate does. llvm-svn: 70081 --- clang/lib/Sema/SemaExpr.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'clang/lib/Sema/SemaExpr.cpp') diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp index 474670dbb7a..e7d5ee18ff8 100644 --- a/clang/lib/Sema/SemaExpr.cpp +++ b/clang/lib/Sema/SemaExpr.cpp @@ -4928,8 +4928,7 @@ bool Sema::DiagnoseAssignmentResult(AssignConvertType ConvTy, return isInvalid; } -bool Sema::VerifyIntegerConstantExpression(const Expr* E, llvm::APSInt *Result) -{ +bool Sema::VerifyIntegerConstantExpression(const Expr *E, llvm::APSInt *Result){ Expr::EvalResult EvalResult; if (!E->Evaluate(EvalResult, Context) || !EvalResult.Val.isInt() || -- cgit v1.2.3