Bug 16540 – Attributes do not propagate correctly in lazy params

Status
RESOLVED
Resolution
FIXED
Severity
enhancement
Priority
P3
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2016-09-25T20:35:00Z
Last change time
2017-08-07T13:16:11Z
Assigned to
nobody
Creator
eyal

Comments

Comment #0 by eyal — 2016-09-25T20:35:06Z
// Compiles just fine: void foo(scope int* delegate() f) @nogc { } void bar() @nogc { foo({ return new int(5); }); } // Fails: void foo1(scope lazy int* f) @nogc { } void bar1() @nogc { foo(new int(5)); // It does not understand that the new here is wrapped in an invisible delegate } --- This is a real problem in the context of an assertion template that wants to declare itself pure, @nogc, etc -- because it is. Only when the assert fails, it is GC'd, non-pure, etc, but in those case we abort anyway so all of those properties are not visible to the caller.
Comment #1 by bugzilla — 2017-05-13T13:25:45Z
This is working successfully in the current DMD version.
Comment #2 by bugzilla — 2017-05-13T13:31:58Z
Added test case to ensure it keeps working: https://github.com/dlang/dmd/pull/6776
Comment #3 by github-bugzilla — 2017-05-21T02:35:14Z
Commits pushed to master at https://github.com/dlang/dmd https://github.com/dlang/dmd/commit/1391130b641cab14e28de0c3490336cbb60ab2f2 fix Issue 16540 - Attributes do not propagate correctly in lazy params https://github.com/dlang/dmd/commit/01e29d4ba2658882fe63063e13a4095e37209a7d Merge pull request #6776 from WalterBright/test16540 fix Issue 16540 - Attributes do not propagate correctly in lazy params merged-on-behalf-of: Daniel Murphy <[email protected]>
Comment #4 by github-bugzilla — 2017-08-07T13:16:11Z
Commits pushed to newCTFE at https://github.com/dlang/dmd https://github.com/dlang/dmd/commit/1391130b641cab14e28de0c3490336cbb60ab2f2 fix Issue 16540 - Attributes do not propagate correctly in lazy params https://github.com/dlang/dmd/commit/01e29d4ba2658882fe63063e13a4095e37209a7d Merge pull request #6776 from WalterBright/test16540