summaryrefslogtreecommitdiffstats
path: root/clang
diff options
context:
space:
mode:
Diffstat (limited to 'clang')
-rw-r--r--clang/lib/CodeGen/CGExprComplex.cpp6
-rw-r--r--clang/test/CodeGen/complex.c3
2 files changed, 6 insertions, 3 deletions
diff --git a/clang/lib/CodeGen/CGExprComplex.cpp b/clang/lib/CodeGen/CGExprComplex.cpp
index e4b2f3b3fb4..796c55a4bdb 100644
--- a/clang/lib/CodeGen/CGExprComplex.cpp
+++ b/clang/lib/CodeGen/CGExprComplex.cpp
@@ -114,9 +114,9 @@ public:
if (result.isReference())
return EmitLoadOfLValue(result.getReferenceLValue(CGF, E));
- llvm::ConstantStruct *pair =
- cast<llvm::ConstantStruct>(result.getValue());
- return ComplexPairTy(pair->getOperand(0), pair->getOperand(1));
+ llvm::Constant *pair = result.getValue();
+ return ComplexPairTy(pair->getAggregateElement(0U),
+ pair->getAggregateElement(1U));
}
return EmitLoadOfLValue(E);
}
diff --git a/clang/test/CodeGen/complex.c b/clang/test/CodeGen/complex.c
index e99a7152813..206db253caa 100644
--- a/clang/test/CodeGen/complex.c
+++ b/clang/test/CodeGen/complex.c
@@ -95,3 +95,6 @@ double t7(double _Complex c) {
void t8() {
__complex__ int *x = &(__complex__ int){1};
}
+
+const _Complex double test9const = 0;
+_Complex double test9func() { return test9const; }
OpenPOWER on IntegriCloud