← Back to index
|
Original Bugzilla link
Bug 16678 – [REG] Fix for issue 16193 creates major breakage
Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2016-11-10T13:02:00Z
Last change time
2017-01-16T23:24:55Z
Assigned to
nobody
Creator
public
Comments
Comment #0
by public — 2016-11-10T13:02:27Z
Original issue:
https://issues.dlang.org/show_bug.cgi?id=16193
Change in
https://github.com/dlang/dmd/commit/f7819c898a05d28297024b7355d4ace94f1e4465
(later adjusted in
https://github.com/dlang/dmd/commit/f55b4d970b9463fda459fedf13bbcd58369d9ee9)
fixed that issue by conservatively allocating a closure unless `opApply` is scope. However, this breaks existing code if closure is attempted on struct with destructor: $ cat sample.d unittest { static struct External { ~this () { } void foo () { } } static struct Iterable { int opApply ( int delegate ( int ) dg ) { return dg(42); } } static void foo (External s1, Iterable s2) { foreach (x; s2) { s1.foo(); } } foo (External.init, Iterable.init); } $ dmd-dev -transition=safe -unittest -main -run sample.d sample.d(20): To enforce @safe compiler allocates a closure unless the opApply() uses 'scope' sample.d(18): Error: variable sample.__unittestL1_1.foo.s1 has scoped destruction, cannot build closure
Comment #1
by public — 2016-11-10T16:31:12Z
Introduced via
https://github.com/dlang/phobos/pull/4583
Comment #2
by public — 2016-11-10T16:32:03Z
(discard previous comment, wrong issue)
Comment #3
by bugzilla — 2016-11-11T01:50:07Z
https://github.com/dlang/dmd/pull/6251
Comment #4
by github-bugzilla — 2016-11-12T02:59:42Z
Commit pushed to stable at
https://github.com/dlang/dmd
https://github.com/dlang/dmd/commit/8c00c7ea978dad3236148ea6fa57a1a9f8af3186
Merge pull request #6251 from Dicebot/revert-regressions Fix Issue 16678 - [REG] Fix for issue 16193 creates major breakage
Comment #5
by github-bugzilla — 2016-12-18T22:53:06Z
Commit pushed to master at
https://github.com/dlang/dmd
https://github.com/dlang/dmd/commit/8c00c7ea978dad3236148ea6fa57a1a9f8af3186
Merge pull request #6251 from Dicebot/revert-regressions
Comment #6
by github-bugzilla — 2016-12-27T14:41:05Z
Commit pushed to scope at
https://github.com/dlang/dmd
https://github.com/dlang/dmd/commit/8c00c7ea978dad3236148ea6fa57a1a9f8af3186
Merge pull request #6251 from Dicebot/revert-regressions
Comment #7
by github-bugzilla — 2017-01-16T23:24:55Z
Commit pushed to newCTFE at
https://github.com/dlang/dmd
https://github.com/dlang/dmd/commit/8c00c7ea978dad3236148ea6fa57a1a9f8af3186
Merge pull request #6251 from Dicebot/revert-regressions