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

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Jan 27 11:27:08 UTC 2021


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

RazvanN <razvan.nitu1305 at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |razvan.nitu1305 at gmail.com

--- Comment #2 from RazvanN <razvan.nitu1305 at gmail.com> ---
>From spec [1]: "A function in a derived class with the same name and covariant
with a function in a base class overrides that function". Also, [2] (point 8)
defines covariance: "A covariant function has a type that is implicitly
convertible to the type of the overridden function.". Finally, [3] (point 6)
shows that @safe functions are covariant with @system functions.

PR that explicitly introduced this: https://github.com/dlang/dmd/pull/6731 .

I think that this case was simply overlooked. Functions that implement
interface functions should match exactly.

[1] https://dlang.org/spec/function.html#function-inheritance
[2] https://dlang.org/spec/function.html#virtual-functions
[3] https://dlang.org/spec/function.html#safe-functions

--


More information about the Digitalmars-d-bugs mailing list