[Issue 6176] [TDPL] Cannot use string variables in case expressions
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sun Jun 19 10:44:28 PDT 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6176
Stewart Gordon <smjg at iname.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords|rejects-valid |spec
CC| |smjg at iname.com
Severity|normal |enhancement
--- Comment #1 from Stewart Gordon <smjg at iname.com> 2011-06-19 10:39:42 PDT ---
http://www.digitalmars.com/d/1.0/statement.html#CaseStatement
"The case expressions must all evaluate to a constant value or array. They must
be implicitly convertible to the type of the switch Expression."
http://www.digitalmars.com/d/2.0/statement.html#CaseStatement
"The case expressions must all evaluate to a constant value or array, or a
runtime initialized const or immutable variable of integral type. They must be
implicitly convertible to the type of the switch Expression."
So the code is illegal. Clearly this is a mistake in TDPL.
Though I am made to wonder why this restriction is there. Changing to
enhancement for the meantime.
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list