]> granicus.if.org Git - clang/commitdiff
Add missing code for compound literals of complex type. <rdar://problem/10938628>
authorEli Friedman <eli.friedman@gmail.com>
Mon, 27 Feb 2012 20:26:13 +0000 (20:26 +0000)
committerEli Friedman <eli.friedman@gmail.com>
Mon, 27 Feb 2012 20:26:13 +0000 (20:26 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151549 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CGExprComplex.cpp
test/CodeGen/complex-init-list.c

index ae192cb8365dd82f2660df0f407d8ccec476f697..d2a760054b5677367d34e53a611f425a99b39311 100644 (file)
@@ -261,6 +261,10 @@ public:
 
   ComplexPairTy VisitInitListExpr(InitListExpr *E);
 
+  ComplexPairTy VisitCompoundLiteralExpr(CompoundLiteralExpr *E) {
+    return EmitLoadOfLValue(E);
+  }
+
   ComplexPairTy VisitVAArgExpr(VAArgExpr *E);
 
   ComplexPairTy VisitAtomicExpr(AtomicExpr *E) {
index 819d4f9432de63352159438cf3e0dfe9b4c1e8d4..99c1c62b58844e6c50991a62267e322b6bfb1343 100644 (file)
@@ -9,4 +9,10 @@ _Complex float x = { 1.0f, 1.0f/0.0f };
 
 _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 }