Thread overview | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
August 21, 2015 [Issue 14944] cannot initialize static array by static this() | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=14944 yosikawa@altalk.com changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |yosikawa@altalk.com -- |
August 21, 2015 [Issue 14944] cannot initialize static array by static this() | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=14944 bb.temp@gmx.com changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |bb.temp@gmx.com --- Comment #1 from bb.temp@gmx.com --- The problem is more subtle than suggested by the summary. Actually the problem is the **ref** in foreach(). Initialization of the array succeeds if you use another form of for loop, e.g --- import std.stdio; class Foo { static int[10] tbl; static this() { foreach(i; 0 .. tbl.length) { tbl[i] = 1; } } } void main() { writeln(Foo.tbl[0]); // 1 } --- -- |
August 21, 2015 [Issue 14944] cannot initialize static array by static this() | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=14944 Jonathan M Davis <issues.dlang@jmdavisProg.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |issues.dlang@jmdavisProg.co | |m --- Comment #2 from Jonathan M Davis <issues.dlang@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. -- |
September 01, 2015 [Issue 14944] cannot initialize static array by static this() | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=14944 Vladimir Panteleev <thecybershadow@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |wrong-code CC| |thecybershadow@gmail.com Hardware|x86_64 |All OS|Windows |All -- |
September 01, 2015 [Issue 14944] cannot initialize static array by static this() | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=14944 Vladimir Panteleev <thecybershadow@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Severity|normal |regression --- Comment #3 from Vladimir Panteleev <thecybershadow@gmail.com> --- This is a regression. Introduced in https://github.com/D-Programming-Language/dmd/pull/2665 -- |
September 01, 2015 [Issue 14944] [REG2.064] cannot initialize static array by static this() | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=14944 Kenji Hara <k.hara.pg@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |pull Summary|cannot initialize static |[REG2.064] cannot |array by static this() |initialize static array by | |static this() --- Comment #4 from Kenji Hara <k.hara.pg@gmail.com> --- https://github.com/D-Programming-Language/dmd/pull/5013 -- |
September 02, 2015 [Issue 14944] [REG2.064] cannot initialize static array by static this() | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=14944 github-bugzilla@puremagic.com changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution|--- |FIXED -- |
September 02, 2015 [Issue 14944] [REG2.064] cannot initialize static array by static this() | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=14944 --- Comment #5 from github-bugzilla@puremagic.com --- Commits pushed to stable at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/1d621e240a0f8d7df60fb1c7f14da21532aa99d5 fix Issue 14944 - cannot initialize static array by static this() https://github.com/D-Programming-Language/dmd/commit/e6e75a6892fc63307f940e867c0fcdc55406cf9d Merge pull request #5013 from 9rnsr/fix14944 [REG2.064] Issue 14944 - cannot initialize static array by static this() -- |
September 06, 2015 [Issue 14944] [REG2.064] cannot initialize static array by static this() | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=14944 --- Comment #6 from github-bugzilla@puremagic.com --- Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/1d621e240a0f8d7df60fb1c7f14da21532aa99d5 fix Issue 14944 - cannot initialize static array by static this() https://github.com/D-Programming-Language/dmd/commit/e6e75a6892fc63307f940e867c0fcdc55406cf9d Merge pull request #5013 from 9rnsr/fix14944 -- |
March 21, 2020 [Issue 14944] [REG2.064] cannot initialize static array by static this() | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=14944 Basile-z <b2.temp@gmx.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC|b2.temp@gmx.com | -- |
Copyright © 1999-2021 by the D Language Foundation