[Issue 14728] Problems in the switch statement with enumerated data types
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Tue Jun 23 14:45:58 PDT 2015
https://issues.dlang.org/show_bug.cgi?id=14728
--- Comment #2 from dennis.m.ritchie at mail.ru ---
(In reply to Vladimir Panteleev from comment #1)
> Here "," is the comma operator, which works as in C (i.e. the first
> expression is evaluated but its result is discarded). It is the same
> situation as e.g.
>
> if (x, y) { ... }
>
> The compiler should probably warn that the expression "x" has no side
> effects.
Yes, probably, it would be nice if the compiler warns about this.
But I see the second problem. Why is it compiled?
int x = 1;
int y = 2;
but it is not compiled into a switch statement?
I think that this option should also be compiled:
int x = 1;
long y = 2;
--
More information about the Digitalmars-d-bugs
mailing list