[Issue 6176] [tdpl] Cannot use string variables in case expressions
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Wed Jan 18 10:16:15 PST 2012
http://d.puremagic.com/issues/show_bug.cgi?id=6176
Andrej Mitrovic <andrej.mitrovich at gmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |andrej.mitrovich at gmail.com
--- Comment #21 from Andrej Mitrovic <andrej.mitrovich at gmail.com> 2012-01-18 10:16:13 PST ---
Switch allows more funky code:
import std.stdio;
string a() { return "a"; }
void main()
{
switch ("a") {
case a():
writeln("true");
default:
}
}
and:
import std.stdio;
int foo() { return 1; }
void main()
{
int x;
switch (x = foo())
{
default:
}
}
`if (x = foo())` can't work, so I don't know why `switch (x = foo())` can.
--
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