https://issues.dlang.org/show_bug.cgi?id=23767
Issue ID: 23767
Summary: ImportC: ternary with null constant has wrong pointer
type
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Keywords: ImportC
Severity: normal
Priority: P4
Component: dmd
Assignee: [email protected]
Reporter: [email protected]
In a C ternary expression, when one expression is a pointer and the other is
the null pointer constant, the resulting type should be the pointer. This
compiles with GCC:
```
int arr[4];
void f(void)
{
int x = *(0 ? (void*)0 : arr);
}
```
But with ImportC, it considers the type a void pointer and errors with:
```
Error: expression `*(0 ? cast(void*)0 : &arr)` is `void` and has no value
```
--