June 17, 2005 -w & nested classes | ||||
---|---|---|---|---|
| ||||
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 class Outer{ Inner inner; class Inner{ } this(){ inner = new Inner(); } } Outer.Inner test(){ auto Outer o = new Outer(); return o.inner; } int main(){ Outer.Inner i = test(); } "-w" complains: "test no return at end of function" Is this code legal or should the compiler complain that "i" is pointing to a defunct instance? Thomas -----BEGIN PGP SIGNATURE----- iD8DBQFCsw1o3w+/yD4P9tIRArO7AJ94AjX8qRZrv5Ms5F7gn4VzUU3FKgCcDF7v LJTAvAl6OTUmFqU0/fqQ/00= =zZdR -----END PGP SIGNATURE----- |
June 18, 2005 Re: -w & nested classes | ||||
---|---|---|---|---|
| ||||
Posted in reply to Thomas Kuehne | "Thomas Kuehne" <thomas-dloop@kuehne.this-is-spam.cn> wrote in message news:84fbo2-1bu.ln1@lnews.kuehne.cn... > Is this code legal or should the compiler complain that "i" is pointing to a defunct instance? It's not legal, but in the general case it's impossible for the compiler to detect it. |
Copyright © 1999-2021 by the D Language Foundation