=?utf-8?q?Mészáros?= Gergely <maetv...@gmail.com>,Gergely Meszaros
 <gergely.mesza...@intel.com>,Gergely Meszaros <gergely.mesza...@intel.com>
Message-ID:
In-Reply-To: <llvm.org/llvm/llvm-project/pull/131...@github.com>


================
@@ -10685,6 +10724,7 @@ QualType Sema::CheckMultiplyDivideOperands(ExprResult 
&LHS, ExprResult &RHS,
   if (compType.isNull() || !compType->isArithmeticType())
     return InvalidOperands(Loc, LHS, RHS);
   if (IsDiv) {
+    DetectPrecisionLossInComplexDivision(*this, RHS.get()->getType(), Loc);
----------------
zahiraam wrote:

> The dividend is not relevant assuming its a built-in arithmetic type, which I 
> think it must be at this point in the code already. I'll try verifying this 
> assumption though. Note that IIUC the types have "usual arithmetic 
> conversions" applied to them here.
> 
> Whether the dividend is real or complex does not matter because complex 
> divided by complex and real divided by complex both need promotion, but 
> neither complex by complex (because it is elementwise) or real by real do.

OK looking at the divisor's type only is enough. When the divisor is of complex 
type than a promotion is needed. When the complex type of the divisor and the 
dividend are not of the same precision, a promotion is needed but that's 
happening with the current code.
How about if we have `_Complex float / double`? Or` _Complex double / float`? 
This should need a promotion, and it's not in the patch.

https://github.com/llvm/llvm-project/pull/131477
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to