[Issue 20823] New: [DIP 1000] un- at safe code fails with dip1000
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Tue May 12 08:05:25 UTC 2020
https://issues.dlang.org/show_bug.cgi?id=20823
Issue ID: 20823
Summary: [DIP 1000] un- at safe code fails with dip1000
Product: D
Version: D2
Hardware: x86_64
OS: Linux
Status: NEW
Severity: normal
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: zero at vec4.xyz
Adding -preview=dip1000 breaks code that is not annotated as @safe.
void boo(T)(T[] data, scope void delegate(T[] data) @nogc fun) {
fun(data);
}
void goo(T)(T[] data, /+scope+/ void delegate(T[] data) @nogc fun) {
fun(data);
}
int[256] arr;
void main() {
void Execute(T)(T[] data) @nogc {
// ...
}
// Works
goo(arr[0..$], &Execute!int);
// Compiler error with DIP 1000
boo(arr[0..$], &Execute!int);
}
---
Error: template onlineapp.boo cannot deduce function from argument types
!()(int[], void delegate(int[] data) pure nothrow @nogc @safe), candidates are:
onlineapp.d(2): boo(T)(T[] data, scope void delegate(T[] data) @nogc
fun)
---
https://run.dlang.io/is/mvYgJ9
--
More information about the Digitalmars-d-bugs
mailing list