[Issue 13550] New: Inner functions take outer function attributes erroneously
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Sun Sep 28 01:47:36 PDT 2014
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 at puremagic.com
Reporter: bearophile_hugs at 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.
--
More information about the Digitalmars-d-bugs
mailing list