[Issue 21538] New: Overriding with more attributes on delegate parameter is allowed

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Jan 10 01:03:29 UTC 2021


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

          Issue ID: 21538
           Summary: Overriding with more attributes on delegate parameter
                    is allowed
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: regression
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: qs.il.paperinik at gmail.com

interface I
{
    void f(const void delegate() dg) const @safe;
}

class C : I
{
    // this overrride should not be legal
    override void f(const void delegate() @safe dg) const @safe { }
}

void main() @safe
{
    const void delegate() @system dg = { };
    C c = new C;
    // c.f(dg); // error, expected
    (cast(I) c).f(dg); // no error
}

--


More information about the Digitalmars-d-bugs mailing list