[Issue 21545] New: [dip1000] cannot assign ref returning delegate to variable with lower attributes

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Jan 13 21:37:07 UTC 2021


https://issues.dlang.org/show_bug.cgi?id=21545

          Issue ID: 21545
           Summary: [dip1000] cannot assign ref returning delegate to
                    variable with lower attributes
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: qs.il.paperinik at gmail.com

Using -preview=dip1000, one cannot assign e.g. a pure delegate to a delegate
type variable without pure annotation:

void main()
{
    int i;
    alias DG = ref int delegate() @safe;
    DG dg = delegate ref() @safe => i;
}

This errors on the assignment of DG. Without the preview switch, it compiles.

--


More information about the Digitalmars-d-bugs mailing list