Thread overview |
---|
July 14, 2006 [Issue 252] New: -w and switch returns = compile errors | ||||
---|---|---|---|---|
| ||||
http://d.puremagic.com/issues/show_bug.cgi?id=252 Summary: -w and switch returns = compile errors Product: D Version: 0.162 Platform: PC OS/Version: Windows Status: NEW Keywords: diagnostic, rejects-valid Severity: minor Priority: P2 Component: DMD AssignedTo: bugzilla@digitalmars.com ReportedBy: jpelcis@gmail.com char[] foo (int bar) { switch (bar) { case 1: return "1"; case 2: return "2"; default: return "many"; } } Compiling this gives the following incorrect error message: C:\programs>dmd -w test.d warning - test.d(1): function test.foo no return at end of function Severity is minor because there are at least 3 easy workarounds: Use if-else. Assign to a temporary variable and return that outside of the switch. Place a return immediately after the switch. -- |
February 12, 2007 [Issue 252] -w and switch returns = bogus "no return at end of function" warning | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | http://d.puremagic.com/issues/show_bug.cgi?id=252 smjg@iname.com changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |smjg@iname.com Summary|-w and switch returns = |-w and switch returns = |compile errors |bogus "no return at end of | |function" warning ------- Comment #1 from smjg@iname.com 2007-02-11 20:04 ------- Probably part of the same bug: If you add a statement after the switch, it fails to report "statement is not reachable". -- |
July 02, 2008 [Issue 252] -w and switch returns = bogus "no return at end of function" warning | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | http://d.puremagic.com/issues/show_bug.cgi?id=252 bugzilla@digitalmars.com changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |arkangath@gmail.com ------- Comment #2 from bugzilla@digitalmars.com 2008-07-01 23:21 ------- *** Bug 1169 has been marked as a duplicate of this bug. *** -- |
July 02, 2008 [Issue 252] -w and switch returns = bogus "no return at end of function" warning | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | http://d.puremagic.com/issues/show_bug.cgi?id=252 davidl@126.com changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |WORKSFORME ------- Comment #3 from davidl@126.com 2008-07-02 04:07 ------- seems this code compiles fine in dmd 1.031 -- |
July 02, 2008 [Issue 252] -w and switch returns = bogus "no return at end of function" warning | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | http://d.puremagic.com/issues/show_bug.cgi?id=252 davidl@126.com changed: What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |REOPENED Resolution|WORKSFORME | ------- Comment #4 from davidl@126.com 2008-07-02 04:10 ------- sorry ... it's a warning related issue...reopened -- |
July 10, 2008 [Issue 252] -w and switch returns = bogus "no return at end of function" warning | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | http://d.puremagic.com/issues/show_bug.cgi?id=252 bugzilla@digitalmars.com changed: What |Removed |Added ---------------------------------------------------------------------------- Status|REOPENED |RESOLVED Resolution| |FIXED ------- Comment #5 from bugzilla@digitalmars.com 2008-07-09 22:31 ------- Fixed dmd 1.032 and 2.016 -- |
Copyright © 1999-2021 by the D Language Foundation