mirror of
https://github.com/intel/llvm.git
synced 2026-01-27 14:50:42 +08:00
Properly do a float -> _Complex double conversion, fixes rdar://8875946.
llvm-svn: 123759
This commit is contained in:
@@ -528,7 +528,8 @@ QualType Sema::UsualArithmeticConversions(Expr *&lhsExpr, Expr *&rhsExpr,
|
||||
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;
|
||||
|
||||
@@ -80,3 +80,9 @@ EVAL_EXPR(38, __builtin_expect(1,1) == 1 ? 1 : -1)
|
||||
// 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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user