www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 22755] New: ImportC: Error: can only `*` a pointer, not a

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

          Issue ID: 22755
           Summary: ImportC: Error: can only `*` a pointer, not a `void`
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Keywords: ImportC, rejects-valid
          Severity: major
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: dave287091 gmail.com

This common C idiom fails to compile:

void* malloc(unsigned long);
int main(){
    int* p = malloc(sizeof *p); // Error: can only `*` a pointer, not a `void`
}

--
Feb 10 2022