[Issue 8538] array variadic apparently doesn't get copied in closure
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sun Apr 3 15:23:08 UTC 2022
https://issues.dlang.org/show_bug.cgi?id=8538
Dennis <dkorpel at live.nl> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |safe
CC| |dkorpel at live.nl
Severity|minor |major
--- Comment #1 from Dennis <dkorpel at live.nl> ---
Bumping the priority, because this is a memory safety issue not caught by @safe
/ dip1000:
```
@safe:
void delegate() @safe test(Object[] objs...) {
return () {assert(objs[0]); assert(objs[1]);};
}
void delegate() @safe foo() {
return test(new Object, new Object);
}
void main() {
auto it = foo(); // but if we build the array elsewhere
it(); // this triggers a failure
}
```
--
More information about the Digitalmars-d-bugs
mailing list