Bug 8951 – static array of context pointer struct s fails:

Status
RESOLVED
Resolution
DUPLICATE
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2012-11-03T02:47:00Z
Last change time
2015-06-09T05:14:48Z
Assigned to
nobody
Creator
monarchdodra

Comments

Comment #0 by monarchdodra — 2012-11-03T02:47:13Z
Creating a static array of structs that have a context pointer is not supported: //---- import std.stdio; void main() { int a; struct S { ~this() { writeln("pre ++a"); ++a; writeln("post ++a"); } } { writeln(1); S stuff; writeln(2); } writeln(3); { writeln(4); S[2] stuff; writeln(5); } writeln(6); } //---- 1 2 pre ++a post ++a 3 4 5 pre ++a object.Error: Access Violation //----
Comment #1 by monarchdodra — 2012-11-03T03:02:18Z
(In reply to comment #0) > Creating a static array of structs that have a context pointer is not > supported: Simpler example: import std.stdio; //---- void main() { int a; struct S { void doit() { writeln("pre ++a"); ++a; writeln("post ++a"); } } { S s; s.doit; } { S[2] ss; ss[0].doit; } } //---- pre ++a post ++a pre ++a object.Error: Access Violation //----
Comment #2 by maxim — 2012-11-03T06:42:44Z
Seems to be issue 8923
Comment #3 by verylonglogin.reg — 2012-11-08T07:32:53Z
*** This issue has been marked as a duplicate of issue 8923 ***