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: [email protected]
Reporter: [email protected]
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.
--