[Issue 24457] New: ImportC: Assignment to double complex fails when using ternary operator
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Wed Mar 27 14:26:05 UTC 2024
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 at puremagic.com
Reporter: lance at 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];
}
}
--
More information about the Digitalmars-d-bugs
mailing list