[Issue 20868] New: DIP1000: scope delegate is implicitly convertible to non-scope delegate
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Thu May 28 05:54:44 UTC 2020
https://issues.dlang.org/show_bug.cgi?id=20868
Issue ID: 20868
Summary: DIP1000: scope delegate is implicitly convertible to
non-scope delegate
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Severity: critical
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: andrej.mitrovich at gmail.com
-----
void scoped (scope void delegate() dg)
{
static void delegate()[] dgs;
// dgs ~= dg; // error
nonScoped(dg); // not an error???
}
void nonScoped (void delegate() dg)
{
static void delegate()[] dgs;
dgs ~= dg;
}
void main ()
{
int x;
scoped({x = 100;});
}
-----
$ dmd -dip1000 test.d
>
This should be a compile-time error.
--
More information about the Digitalmars-d-bugs
mailing list