[cfe-commits] r123759 - in /cfe/trunk: lib/Sema/SemaExpr.cpp test/Sema/const-eval.c
Argyrios Kyrtzidis
akyrtzi at gmail.com
Tue Jan 18 10:49:33 PST 2011
Author: akirtzidis
Date: Tue Jan 18 12:49:33 2011
New Revision: 123759
URL: http://llvm.org/viewvc/llvm-project?rev=123759&view=rev
Log:
Properly do a float -> _Complex double conversion, fixes rdar://8875946.
Modified:
cfe/trunk/lib/Sema/SemaExpr.cpp
cfe/trunk/test/Sema/const-eval.c
Modified: cfe/trunk/lib/Sema/SemaExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=123759&r1=123758&r2=123759&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExpr.cpp Tue Jan 18 12:49:33 2011
@@ -528,7 +528,8 @@
if (order < 0) { // RHS is wider
// float -> _Complex double
if (!isCompAssign) {
- ImpCastExprToType(lhsExpr, rhs, CK_FloatingCast);
+ QualType fp = cast<ComplexType>(rhs)->getElementType();
+ ImpCastExprToType(lhsExpr, fp, CK_FloatingCast);
ImpCastExprToType(lhsExpr, rhs, CK_FloatingRealToComplex);
}
return rhs;
Modified: cfe/trunk/test/Sema/const-eval.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/const-eval.c?rev=123759&r1=123758&r2=123759&view=diff
==============================================================================
--- cfe/trunk/test/Sema/const-eval.c (original)
+++ cfe/trunk/test/Sema/const-eval.c Tue Jan 18 12:49:33 2011
@@ -80,3 +80,9 @@
// PR7884
EVAL_EXPR(39, __real__(1.f) == 1 ? 1 : -1)
EVAL_EXPR(40, __imag__(1.f) == 0 ? 1 : -1)
+
+// rdar://8875946
+void rdar8875946() {
+ double _Complex P;
+ float _Complex P2 = 3.3f + P;
+}
More information about the cfe-commits
mailing list