[SAOC 25] improve importC weekly update 13

Lance Bachmeier no at spam.net
Mon Dec 15 17:14:30 UTC 2025


On Monday, 15 December 2025 at 14:01:36 UTC, Emmanuel wrote:
> Hi all,
>
> This week, I fixed complex compile time error when used in 
> tenary operators.
>
>
> ```
>
> void foo() {
>     double *a;
>     double _Complex *b;
>     double _Complex zden;
>     double c, d;
>     zden = c > d? b[0]: a[0];
> }
> ```
>
> in a tenary operator setup like this, DMD reported incompatible 
> types between the `double` nd the `double _Complex`. no common 
> type handler did not exist for complex types which expected for 
> the `double` to be type casted to `double _Complex`.
>
> But then this fix led to more investigations as importC uses 
> complex library struct instead of the deprecated fundamental D 
> complex type.  And I am still investigating other issues with 
> complex numbers to see if I will need to do that transition to 
> make C use fundamental complex.

Thanks for figuring this out. I was the one that filed the bug in 
question. It would be valuable for scientific code to have 
complex numbers just work with ImportC. I recall looking into 
this before opening the issue, but that turned out to be a rabbit 
hole I didn't want to go down.


More information about the Digitalmars-d mailing list