May 12, 2020 [Issue 20823] New: [DIP 1000] un-@safe code fails with dip1000 | ||||
|---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=20823 Issue ID: 20823 Summary: [DIP 1000] un-@safe code fails with dip1000 Product: D Version: D2 Hardware: x86_64 OS: Linux Status: NEW Severity: normal Priority: P1 Component: dmd Assignee: nobody@puremagic.com Reporter: zero@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 -- | ||||
Copyright © 1999-2021 by the D Language Foundation
Permalink
Reply