Bug 20063 – compiler segfaults on passing templates expression to lazy val

Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2019-07-18T13:49:09Z
Last change time
2020-03-21T03:56:34Z
Keywords
ice, pull
Assigned to
No Owner
Creator
Ali Ak

Comments

Comment #0 by ali.akhtarzada — 2019-07-18T13:49:09Z
import std; struct S { void f(alias fun)() {} } auto handleLazily(T)(lazy T expr) {} void main() { class C {} S().f!(() => new C()) .handleLazily; } Produced "Segmentation fault (core dumped)" dmd ver 2.087 LDC produces compiler error: onlineapp.d(12): Error: template instance `f!(delegate () => new C)` cannot use local __lambda2 as parameter to non-global template f(alias fun)()
Comment #1 by b2.temp — 2019-07-18T22:23:52Z
That's a 2.087 regression caused by the fix for non global templates (https://issues.dlang.org/show_bug.cgi?id=5710).
Comment #2 by dlang-bot — 2019-07-18T23:32:28Z
@SSoulaimane created dlang/dmd pull request #10196 "Fix issue 20063 - Patch closure variables when converting expressions to delegates" fixing this issue: - Fix issue 20063 - Patch closure variables when converting expressions to delegates https://github.com/dlang/dmd/pull/10196
Comment #3 by dlang-bot — 2019-07-19T04:15:50Z
dlang/dmd pull request #10196 "Fix issue 20063 - Patch closure variables when converting expressions to delegates" was merged into stable: - 127fc3fc07c8c62402f8dd8d2ee3b08dc72b5395 by سليمان السهمي (Suleyman Sahmi): Fix issue 20063 - Patch closure variables when converting expressions to delegates https://github.com/dlang/dmd/pull/10196