Bug 12829 – Wrong error line number for closure allocation in @nogc function
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2014-05-31T20:17:00Z
Last change time
2017-08-02T08:07:10Z
Keywords
diagnostic, pull
Assigned to
nobody
Creator
bearophile_hugs
Comments
Comment #0 by bearophile_hugs — 2014-05-31T20:17:12Z
void main() @nogc {
int x;
void delegate() @nogc foo;
foo = () {
int y = x;
};
}
DMD 2.066alpha gives a bad line number that doesn't help me locate where the closure is defined or created inside the main function:
test.d(1,6): Error: function D main @nogc function allocates a closure with the GC
Comment #1 by bearophile_hugs — 2014-06-02T12:19:16Z
This reports only one closure:
void main() @nogc {
int x;
void delegate() @nogc foo;
foo = () {
int y = x;
};
void delegate() @nogc bar;
bar = () {
int y = x;
};
}
test.d(1,6): Error: function D main @nogc function allocates a closure with the GC
Comment #2 by bearophile_hugs — 2015-01-11T18:28:03Z