www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - -w & nested classes

reply Thomas Kuehne <thomas-dloop kuehne.this-is-spam.cn> writes:
-----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-----
Jun 17 2005
parent "Walter" <newshound digitalmars.com> writes:
"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.
Jun 17 2005