Don wrote:
Jason House wrote:
I think you have a bad corner case:
enum int ct = -1;
immutable rt = -1;
ct ^^ ct // Error (compile time)
This would always get rewritten.
rt ^^ ct // Error (compile time)
rt ^^ rt // Error (run time)
ct ^^ rt // Works??? (after rewrite)
No, they will all work. Both rt and ct are manifest constants.
(Actually it's a bit of wierd compiler quirk that const/immutables
initialized with literal values are manifest constants; they aren't
constants if initialized with anything else. This behaviour may change,
but it doesn't affect this scheme).
If however rt is just
int rt = -1;
then
ct ^^ ct and ct ^^ rt work, and the other two fail. This is intended.