Add missing code for compound literals of complex type. <rdar://problem/10938628>
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151549 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/CodeGen/CGExprComplex.cpp b/lib/CodeGen/CGExprComplex.cpp
index ae192cb..d2a7600 100644
--- a/lib/CodeGen/CGExprComplex.cpp
+++ b/lib/CodeGen/CGExprComplex.cpp
@@ -261,6 +261,10 @@
ComplexPairTy VisitInitListExpr(InitListExpr *E);
+ ComplexPairTy VisitCompoundLiteralExpr(CompoundLiteralExpr *E) {
+ return EmitLoadOfLValue(E);
+ }
+
ComplexPairTy VisitVAArgExpr(VAArgExpr *E);
ComplexPairTy VisitAtomicExpr(AtomicExpr *E) {
diff --git a/test/CodeGen/complex-init-list.c b/test/CodeGen/complex-init-list.c
index 819d4f9..99c1c62 100644
--- a/test/CodeGen/complex-init-list.c
+++ b/test/CodeGen/complex-init-list.c
@@ -9,4 +9,10 @@
_Complex float f(float x, float y) { _Complex float z = { x, y }; return z; }
// CHECK: define <2 x float> @f
-// CHECK: alloca { float, float }
\ No newline at end of file
+// CHECK: alloca { float, float }
+// CHECK: alloca { float, float }
+
+_Complex float f2(float x, float y) { return (_Complex float){ x, y }; }
+// CHECK: define <2 x float> @f2
+// CHECK: alloca { float, float }
+// CHECK: alloca { float, float }