March 27
https://issues.dlang.org/show_bug.cgi?id=24457

          Issue ID: 24457
           Summary: ImportC: Assignment to double complex fails when using
                    ternary operator
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody@puremagic.com
          Reporter: lance@lancebachmeier.com

This compiles with gcc but not dmd:

#include <complex.h>

void foo() {
    double * a;
    double complex * b;
    double complex zden;
    double c, d;
    zden = c > d? b[0]: a[0];
}

Error: incompatible types for `(*(b + cast(long)0 * 16L)) : (*(a + cast(long)0
* 8L))`: `_Complex!double` and `double`

This compiles with both gcc and dmd, so it's a problem of the ternary operator:

#include <complex.h>

void foo() {
    double * a;
    double complex * b;
    double complex zden;
    double c, d;
    zden = a[0];
    zden = b[0];
    if (c > d) {
      zden = b[0];
    } else {
      zden = a[0];
    }
}

--