http://d.puremagic.com/issues/show_bug.cgi?id=5713


Stewart Gordon <s...@iname.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |spec, wrong-code
                 CC|                            |s...@iname.com


--- Comment #1 from Stewart Gordon <s...@iname.com> 2011-03-07 05:39:56 PST ---
At first I thought maybe it was ignoring the error out of knowledge that x % 3
== 1 in this instance.  But no - it still accepts (and runs without even a
SwitchError) if I change x to 101.

But you'd need to cover -1 and -2 as well for this to make sense.

The spec doesn't actually disallow it:
http://www.digitalmars.com/d/2.0/statement.html#FinalSwitchStatement

"A final switch statement is just like a switch statement, except that:

    * No DefaultStatement is allowed.
    * No CaseRangeStatements are allowed.
    * If the switch Expression is of enum type, all the enum members must
appear in the CaseStatements.
    * The case expressions cannot evaluate to a run time initialized value."

But this seems to be a mistake, and that no SwitchError is thrown strikes me as
a bug.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------

Reply via email to