Bug 21140 – [REG2.086] Error on missed stack allocation for closure for template

Status
NEW
Severity
regression
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2020-08-09T21:54:01Z
Last change time
2024-12-13T19:10:43Z
Keywords
industry, performance, rejects-valid
Assigned to
No Owner
Creator
Walter Bright
See also
https://issues.dlang.org/show_bug.cgi?id=20596
Moved to GitHub: dmd#19762 →

Comments

Comment #0 by bugzilla — 2020-08-09T21:54:01Z
Filed this as a new bug report instead of reopening https://issues.dlang.org/show_bug.cgi?id=20596 ------------------------------------------------------------- [email protected] 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)); } ```
Comment #1 by robert.schadek — 2024-12-13T19:10:43Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/19762 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB