[Issue 20063] New: compiler segfaults on passing templates expression to lazy val

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Jul 18 13:49:09 UTC 2019


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

          Issue ID: 20063
           Summary: compiler segfaults on passing templates expression to
                    lazy val
           Product: D
           Version: D2
          Hardware: x86
                OS: Mac OS X
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: ali.akhtarzada at gmail.com

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)()

--


More information about the Digitalmars-d-bugs mailing list