digitalmars.D.bugs - [Issue 13550] New: Inner functions take outer function attributes
- via Digitalmars-d-bugs (31/31) Sep 28 2014 https://issues.dlang.org/show_bug.cgi?id=13550
https://issues.dlang.org/show_bug.cgi?id=13550 Issue ID: 13550 Summary: Inner functions take outer function attributes erroneously Product: D Version: D2 Hardware: x86 OS: Windows Status: NEW Keywords: rejects-valid Severity: normal Priority: P1 Component: DMD Assignee: nobody puremagic.com Reporter: bearophile_hugs eml.cc Code like this looks correct: auto foo() nogc { static int[] bar() { return new int[2]; } return &bar; } void main() { auto g = foo(); assert(g() == [0, 0]); } But DMD 2.067alpha gives: test.d(3,15): Error: cannot use 'new' in nogc function foo Inner functions take outer function attributes even if (I think) they shouldn't. --
Sep 28 2014