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

RazvanN <[email protected]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|REOPENED                    |RESOLVED
                 CC|                            |[email protected]
         Resolution|---                         |WORKSFORME

--- Comment #5 from RazvanN <[email protected]> ---
Running the second examples now yields:

1
2

This is the expected behavior.

The first example still compiles. I assume that this is necessary in order to
facilitate the compilation of the second example (for consistency reasons).
In D, you have to implement both foo methods, so you must have the ability of
overloading based on return type. Note that instantiating a C and calling foo
will output an error.

C c = new C;
writeln(c.foo());    // foo called with arguments () matches both definitions

Closing as WORKSFORME.

--

Reply via email to