--- Comment #7 from yebblies <> 2011-06-16 06:48:41 PDT ---
(In reply to comment #5)
> Remove the �final� attribute and compile the example with -w, and you'll see.

I get an error when compiling without the final attribute, -w or not.

testx.d(21): Error: function testx.DerivedClass.getEnum of type B() overrides
but is not covariant with testx.BaseClass.getEnum of type A()

> Besides, since when would it be allowed to have two public methods with the
> same signature?

Yes, overloading on return type is disabled for functions in the same scope,
but the rules are a little less strict for deriving classes...
Looking at the spec, it seems to be explicitly disallowed for functions that
would otherwise be virtual.
It can be very useful with template functions, as they need to be redefined in
each class, and is allowed for static functions.

I might be misunderstanding, please post a test case that shows what you mean.

(In reply to comment #6)
> Even if D is working according to specs, I think this is bug-prone enough to
> deserve some warning or even an error.

I think it would be much clearer if override was mandatory, and I'm fairly sure
there's already a report for that.  If there's something else you'd like,
please, write it up.  A test case that compiles does not constitute an
enhancement request without additional information. (unless it's very, very

Configure issuemail:
------- You are receiving this mail because: -------

Reply via email to