digitalmars.D.bugs - [Issue 21140] New: [REG2.086] Error on missed stack allocation for
- d-bugmail puremagic.com (57/57) Aug 09 2020 https://issues.dlang.org/show_bug.cgi?id=21140
https://issues.dlang.org/show_bug.cgi?id=21140 Issue ID: 21140 Summary: [REG2.086] Error on missed stack allocation for closure for template Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: regression Priority: P1 Component: dmd Assignee: nobody puremagic.com Reporter: bugzilla digitalmars.com Filed this as a new bug report instead of reopening https://issues.dlang.org/show_bug.cgi?id=20596 ------------------------------------------------------------- johanengelen weka.io 2020-08-09 10:30:32 UTC writes: Reopening, because the regression is not entirely fixed. See this slightly modified testcase, where variable `s` is not explicitly marked `scoped`. The compiler does not deduce `scope` for `s`. This used to compile and not GC-allocate (<= 2.085) but no longer does. ``` struct S(T) { void delegate() dg; this(scope void delegate() dg) { this.dg = dg; } } nogc void fooTemplate() { int num; void foo() { int dummy = num; } auto s = S!int(&foo); // not explicitly defined as `scope` } ``` and: Another example that fails compilation: ``` struct S(T) { void delegate() dg; this(scope void delegate() dg) { this.dg = dg; } } // The explicit `scope` here is not used in `fooTemplate` nogc auto dosomething(scope S!int s) { } nogc auto fooTemplate() { int num; void foo() { int dummy = num; } dosomething(S!int(&foo)); } ``` --
Aug 09 2020