From: Eli Friedman Date: Mon, 27 Feb 2012 20:26:13 +0000 (+0000) Subject: Add missing code for compound literals of complex type. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=fce4715bc343bf788c3767e16f1492b96ef73b8e;p=clang Add missing code for compound literals of complex type. 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 ae192cb836..d2a760054b 100644 --- a/lib/CodeGen/CGExprComplex.cpp +++ b/lib/CodeGen/CGExprComplex.cpp @@ -261,6 +261,10 @@ public: 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 819d4f9432..99c1c62b58 100644 --- a/test/CodeGen/complex-init-list.c +++ b/test/CodeGen/complex-init-list.c @@ -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 }