[Issue 18945] immutable variable is used as if it's an enum
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Tue Jun 5 12:47:49 UTC 2018
https://issues.dlang.org/show_bug.cgi?id=18945
David Bennett <davidbennett at bravevision.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |davidbennett at bravevision.co
| |m
--- Comment #4 from David Bennett <davidbennett at bravevision.com> ---
I'm not sure what workaround we would recommend in the deprecation messaged as
the current functionality is actually hard to replicate... as enum and static
would give a different runtime result (actually an error in this case as __ctfe
is not known at statictime... only ctfetime and runtime)
The best I could do on short notice was:
unittest {
immutable n = __ctfe ? 1 : 2;
enum l = {return __ctfe ? 1 : 2;}();
int[l] a;
assert(a.length == n);
}
--
More information about the Digitalmars-d-bugs
mailing list