@@ -4627,7 +4627,7 @@ elem* toElemCast(CastExp ce, elem* e, bool isLvalue, ref IRState irs)
46274627 * information available to do it.
46284628 *
46294629 * Casting from a C++ interface to a non-C++ interface
4630- * always results in null because there's no way one
4630+ * always results in null because there is no way one
46314631 * can be derived from the other.
46324632 */
46334633 e = el_bin(OPcomma, TYnptr, e, el_long(TYnptr, 0 ));
@@ -4660,6 +4660,9 @@ elem* toElemCast(CastExp ce, elem* e, bool isLvalue, ref IRState irs)
46604660 if (ftym == ttym)
46614661 return Lret (ce, e);
46624662
4663+ // OSX AArch64 long doubles are 64 bits
4664+ bool RealIsDouble = target.os == Target.os.OSX && target.isAArch64;
4665+
46634666 /* Reduce combinatorial explosion by rewriting the 'to' and 'from' types to a
46644667 * generic equivalent (as far as casting goes)
46654668 */
@@ -4676,6 +4679,10 @@ elem* toElemCast(CastExp ce, elem* e, bool isLvalue, ref IRState irs)
46764679 case Tdchar: tty = Tuns32; break ;
46774680 case Tvoid: return Lpaint(ce, e, ttym);
46784681
4682+ case Tfloat80: if (RealIsDouble) tty = Tfloat64; break ;
4683+ case Timaginary80: if (RealIsDouble) tty = Timaginary64; break ;
4684+ case Tcomplex80: if (RealIsDouble) tty = Tcomplex64; break ;
4685+
46794686 case Tbool:
46804687 {
46814688 // Construct e?true:false
@@ -4703,6 +4710,10 @@ elem* toElemCast(CastExp ce, elem* e, bool isLvalue, ref IRState irs)
47034710 case Tnoreturn:
47044711 return Lret (ce, e);
47054712
4713+ case Tfloat80: if (RealIsDouble) fty = Tfloat64; break ;
4714+ case Timaginary80: if (RealIsDouble) fty = Timaginary64; break ;
4715+ case Tcomplex80: if (RealIsDouble) fty = Tcomplex64; break ;
4716+
47064717 default :
47074718 break ;
47084719 }
0 commit comments