digitalmars.D.bugs - auto declaration & compiler warning "no function return"
- akcom (20/20) Mar 05 2006 private void onRead()
- Stu (30/50) Mar 05 2006 Don't know what the rest of the code's doing but this compiles ok for me
- Brad Roberts (7/29) Mar 05 2006 I'm fairly sure this is a dup of:
private void onRead() { ... auto InternetHost ih = new InternetHost(); if ( ih.getHostByAddr( ia.addr() ) ) { //remember to delete this!! hostName = ih.name.dup; } else { hostName = "unknown"; } ... return true; } compiler gives the following: "warning - peer.d(342): function akp2p.peer.Peer.onRead no return at end of function" but when I remove the "auto" from the ih declaration, everything compiles as expected
Mar 05 2006
Don't know what the rest of the code's doing but this compiles ok for me (DMD.148). Can you give us more of your code to get a small full example which reproduces the error? import std.stdio; import std.socket; void main() { Test t = new Test(); } class Test { private InternetAddress ia; private char[] hostName; private void onRead() { auto InternetHost ih = new InternetHost(); if ( ih.getHostByAddr( ia.addr() ) ) { //remember to delete this!! hostName = ih.name.dup; } else { hostName = "unknown"; } return true; } } Stu In article <dufjl2$11dh$1 digitaldaemon.com>, akcom says...private void onRead() { ... auto InternetHost ih = new InternetHost(); if ( ih.getHostByAddr( ia.addr() ) ) { //remember to delete this!! hostName = ih.name.dup; } else { hostName = "unknown"; } ... return true; } compiler gives the following: "warning - peer.d(342): function akp2p.peer.Peer.onRead no return at end of function" but when I remove the "auto" from the ih declaration, everything compiles as expected
Mar 05 2006
On Sun, 5 Mar 2006, akcom wrote:private void onRead() { ... auto InternetHost ih = new InternetHost(); if ( ih.getHostByAddr( ia.addr() ) ) { //remember to delete this!! hostName = ih.name.dup; } else { hostName = "unknown"; } ... return true; } compiler gives the following: "warning - peer.d(342): function akp2p.peer.Peer.onRead no return at end of function" but when I remove the "auto" from the ih declaration, everything compiles as expectedI'm fairly sure this is a dup of: http://d.puremagic.com/bugzilla/show_bug.cgi?id=5 I've got a potential patch for it in the bug which I just reassigned to walter. Later, Brad
Mar 05 2006