digitalmars.D - ? "Error: one path skips constructor"
- Thomas Kuehne <thomas-dloop kuehne.thisisspam.cn> Dec 10 2004
- "Walter" <newshound digitalmars.com> Dec 10 2004
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
skipping.d
# class FancyExceptionClass : Exception{
# this(int type){
# if(type==1){
# super("type 1");
# /* line 5 */ }else if(type==2){
# super("type 2");
# }else{
# /* line 8 */ throw new Exception("unhandled case");
# }
# }
# }
skipping.d(5): Error: one path skips constructor
Is this a bug or should I add a dummy super call after line 8?
Thomas
-----BEGIN PGP SIGNATURE-----
iD8DBQFBuen63w+/yD4P9tIRAo8bAJ9mXTmqIb3GQrRqYsiWuUXbs+UF+gCgxR+b
rJ7AXV/eRySRbpuzDmQf900=
=A61r
-----END PGP SIGNATURE-----
Dec 10 2004
It's not a bug - the parser does a pretty primitive flow analysis. I'd just add another super call. "Thomas Kuehne" <thomas-dloop kuehne.thisisspam.cn> wrote in message news:q86p82-1i3.ln1 kuehne.cn...-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 skipping.d # class FancyExceptionClass : Exception{ # this(int type){ # if(type==1){ # super("type 1"); # /* line 5 */ }else if(type==2){ # super("type 2"); # }else{ # /* line 8 */ throw new Exception("unhandled case"); # } # } # } skipping.d(5): Error: one path skips constructor Is this a bug or should I add a dummy super call after line 8? Thomas -----BEGIN PGP SIGNATURE----- iD8DBQFBuen63w+/yD4P9tIRAo8bAJ9mXTmqIb3GQrRqYsiWuUXbs+UF+gCgxR+b rJ7AXV/eRySRbpuzDmQf900= =A61r -----END PGP SIGNATURE-----
Dec 10 2004








"Walter" <newshound digitalmars.com>