From: Eli Friedman Date: Mon, 26 Jan 2009 01:33:06 +0000 (+0000) Subject: PR3269: create an empty InitListExpr as a child for the X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=1d24259b5f13663d015c096d5500dcf0ea5ff568;p=clang PR3269: create an empty InitListExpr as a child for the CompoundLiteralExpr so that there aren't any null pointers in the AST. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62981 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp index 1d55ed7c3a..9b91ec6ee5 100644 --- a/lib/Sema/SemaExpr.cpp +++ b/lib/Sema/SemaExpr.cpp @@ -3987,9 +3987,13 @@ Sema::ExprResult Sema::ActOnBuiltinOffsetOf(Scope *S, // Otherwise, create a compound literal expression as the base, and // iteratively process the offsetof designators. - Expr *Res = new (Context) CompoundLiteralExpr(SourceLocation(), ArgTy, 0, - false); - + InitListExpr *IList = + new (Context) InitListExpr(SourceLocation(), 0, 0, + SourceLocation(), false); + IList->setType(ArgTy); + Expr *Res = + new (Context) CompoundLiteralExpr(SourceLocation(), ArgTy, IList, false); + // offsetof with non-identifier designators (e.g. "offsetof(x, a.b[c])") are a // GCC extension, diagnose them. if (NumComponents != 1)