Attribute inference for auto functions?
Walter Bright
newshound2 at digitalmars.com
Thu Apr 18 00:04:46 PDT 2013
On 4/17/2013 11:49 PM, Timon Gehr wrote:
> I am sorry, but I do not understand your notion of covariance.
Overriding functions can add pure or nothrow and remain covariant.
> In the second case you cannot infer the attributes because you do not know all
> subclasses. The signature will potentially not match all overrides.
If you want a precise signature, don't use auto. It's the same case as
everywhere else.
> Case in point, I just noticed the following regression on git head:
>
> import std.stdio;
>
> class C(T){
> T foo(){ return 2; }
> }
>
> class D : C!int{
> override int foo(){ writeln(super.foo()); return 3; } // error
> }
>
>
> Inference shouldn't be done for virtual functions.
>
> http://d.puremagic.com/issues/show_bug.cgi?id=9952
This is not an auto issue.
More information about the Digitalmars-d
mailing list