[Issue 23389] New: ImportC: types from core.stdc.* are distinct types when imported from C
    d-bugmail at puremagic.com 
    d-bugmail at puremagic.com
       
    Wed Oct  5 15:48:22 UTC 2022
    
    
  
https://issues.dlang.org/show_bug.cgi?id=23389
          Issue ID: 23389
           Summary: ImportC: types from core.stdc.* are distinct types
                    when imported from C
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Keywords: ImportC
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: dave287091 at gmail.com
This issue might be tough to be resolve, but is easy to demonstrate:
// s.c
#include <stdio.h>
// d.d
static import s;
static import core.stdc.stdio;
void main(){
    auto f = s.fopen("/dev/null", "r");
    assert(f);
    core.stdc.stdio.fclose(f); // Error 1
    core.stdc.stdio.fclose(cast(shared)f); // Error 2
}
d.d(8): Error: function `core.stdc.stdio.fclose(shared(__sFILE)* stream)` is
not callable using argument types `(__sFILE*)`
d.d(8):        cannot pass argument `f` of type `__sFILE*` to parameter
`shared(__sFILE)* stream`
d.d(9): Error: function `core.stdc.stdio.fclose(shared(__sFILE)* stream)` is
not callable using argument types `(shared(__sFILE*))`
d.d(9):        cannot pass argument `cast(shared(__sFILE*))f` of type
`shared(__sFILE*)` to parameter `shared(__sFILE)* stream`
Those error messages are unhelpful as well.
--
    
    
More information about the Digitalmars-d-bugs
mailing list