[Issue 22732] New: Header generator should export the function attributes by inferring them whenever possible

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Feb 3 16:58:17 UTC 2022


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

          Issue ID: 22732
           Summary: Header generator should export the function attributes
                    by inferring them whenever possible
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: contact at lsferreira.net

```
int[] sysfunc() @system
{
    // unsafe code
    import core.stdc.stdlib : malloc;
    auto p = cast(int*) malloc(5 * int.sizeof);
    return p[0 .. 5];
}

struct S {
    int[] bar() {
        return sysfunc();
    }
}
```

The generated header file doesn't infer `S.bar()` attributes and therefore
exporting the wrong signature.

--


More information about the Digitalmars-d-bugs mailing list