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 1d55ed7..9b91ec6 100644
--- a/lib/Sema/SemaExpr.cpp
+++ b/lib/Sema/SemaExpr.cpp
@@ -3987,9 +3987,13 @@
// 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)