Bug 22732 – Header generator should export the function attributes by inferring them whenever possible

Status
RESOLVED
Resolution
INVALID
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2022-02-03T16:58:17Z
Last change time
2022-02-03T17:08:39Z
Assigned to
No Owner
Creator
Luís Ferreira

Comments

Comment #0 by contact — 2022-02-03T16:58:17Z
``` 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.
Comment #1 by contact — 2022-02-03T17:08:39Z
I just realized by myself that this is actually invalid behaviour and should be explicitly inferred.