[Issue 14944] cannot initialize static array by static this()
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Fri Aug 21 08:41:42 PDT 2015
https://issues.dlang.org/show_bug.cgi?id=14944
Jonathan M Davis <issues.dlang at jmdavisProg.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |issues.dlang at jmdavisProg.co
| |m
--- Comment #2 from Jonathan M Davis <issues.dlang at jmdavisProg.com> ---
The same thing happens if it's a module-level static constructor. So, the class
doesn't matter. And doing the same assignment to the array with a ref in
foreach works in a normal function. It's specifically when that assignment is
done in a static constructor that this happens.
My guess is that it stems from the fact that if a variable is initialized is a
static constructor, then it's not supposed to be initialized before that
(otherwise, you couldn't initialize const or immutable variables that way), but
I don't know.
--
More information about the Digitalmars-d-bugs
mailing list