www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 21538] New: Overriding with more attributes on delegate

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 puremagic.com
          Reporter: qs.il.paperinik 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
}

--
Jan 09 2021