digitalmars.D.bugs - [Issue 17029] New: [Reg 2.072] scope variable may not be returned
- via Digitalmars-d-bugs (33/33) Dec 24 2016 https://issues.dlang.org/show_bug.cgi?id=17029
https://issues.dlang.org/show_bug.cgi?id=17029 Issue ID: 17029 Summary: [Reg 2.072] scope variable may not be returned Product: D Version: D2 Hardware: All OS: All Status: NEW Keywords: safe Severity: regression Priority: P1 Component: dmd Assignee: nobody puremagic.com Reporter: code dawg.eu cat > bug.d << CODE struct Del { void delegate() dg; } Del del(scope void delegate() dg) { return Del(dg); } CODE dmd -c bug ---- bug.d(8): Error: scope variable dg may not be returned ---- This broke at least https://github.com/DlangScience/dstats. Before DIP1000 scope had 2 major use cases, prevent the compiler from allocating closures on the GC heap and scope classes. We must be careful to not just break existing code. --
Dec 24 2016