digitalmars.D.bugs - [Issue 252] New: -w and switch returns = compile errors
- d-bugmail puremagic.com (31/31) Jul 14 2006 http://d.puremagic.com/issues/show_bug.cgi?id=252
- d-bugmail puremagic.com (12/12) Feb 11 2007 http://d.puremagic.com/issues/show_bug.cgi?id=252
- d-bugmail puremagic.com (8/8) Jul 01 2008 http://d.puremagic.com/issues/show_bug.cgi?id=252
- d-bugmail puremagic.com (9/9) Jul 02 2008 http://d.puremagic.com/issues/show_bug.cgi?id=252
- d-bugmail puremagic.com (9/9) Jul 02 2008 http://d.puremagic.com/issues/show_bug.cgi?id=252
- d-bugmail puremagic.com (9/9) Jul 09 2008 http://d.puremagic.com/issues/show_bug.cgi?id=252
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.
--
Jul 14 2006
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
Probably part of the same bug: If you add a statement after the switch, it
fails to report "statement is not reachable".
--
Feb 11 2007
http://d.puremagic.com/issues/show_bug.cgi?id=252
bugzilla digitalmars.com changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |arkangath gmail.com
*** Bug 1169 has been marked as a duplicate of this bug. ***
--
Jul 01 2008
http://d.puremagic.com/issues/show_bug.cgi?id=252
davidl 126.com changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |WORKSFORME
seems this code compiles fine in dmd 1.031
--
Jul 02 2008
http://d.puremagic.com/issues/show_bug.cgi?id=252
davidl 126.com changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|RESOLVED |REOPENED
Resolution|WORKSFORME |
sorry ... it's a warning related issue...reopened
--
Jul 02 2008
http://d.puremagic.com/issues/show_bug.cgi?id=252
bugzilla digitalmars.com changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|REOPENED |RESOLVED
Resolution| |FIXED
Fixed dmd 1.032 and 2.016
--
Jul 09 2008









d-bugmail puremagic.com 