inout problems

deadalnix deadalnix at gmail.com
Wed Feb 22 04:22:41 PST 2012


Le 22/02/2012 05:01, Andrej Mitrovic a écrit :
> class Foo
> {
>      this(int) inout
>      { }
>
>      Foo makeFoo() { return new Foo(1); }
> }
>
> void main() { }
>
> test.d(8): Error: cannot implicitly convert expression (new Foo(1)) of
> type inout(Foo) to test.Foo
>
> Is this a bug?

inout is supposed to propagate a parameter qualifier to the return type. 
Here, inout is useless, and it isn't surprising that it doesn't work.


More information about the Digitalmars-d-learn mailing list