www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 23213] New: ImportC

https://issues.dlang.org/show_bug.cgi?id=23213

          Issue ID: 23213
           Summary: ImportC
           Product: D
           Version: D2
          Hardware: x86_64
                OS: All
            Status: NEW
          Severity: blocker
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: ryuukk.dev gmail.com

The following code doesn't compile:

test.c(4): Error: variable `n` cannot be read at compile time

```
void hello()
{
    int n = 0;
    // some stuff 
    int fds[n == 0 ? 1 : n];
}
``` 


It is valid C code, taken from:
https://github.com/cesanta/mongoose/blob/2bbb2bb1dbbc134c390babd43e474028ede8e8a5/mongoose.c#L3921-L3923

--
Jun 25 2022