Bug 5574 – Struct destructor freaks out when an array of struct with single element is instantiated inside a class

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
Linux
Creation time
2011-02-14T06:59:00Z
Last change time
2011-06-20T03:19:08Z
Assigned to
nobody
Creator
puneet

Comments

Comment #0 by puneet — 2011-02-14T06:59:24Z
I am using version 2.051 of the dmd compiler. I am getting this error when I am instantiating a struct array with a single element inside another class and only if there is the destructor for the struct is explicitly defined. Is it a known error? Here is a minimized snippet that gives error: $ rdmd --main -unittest test.d Error: this for ~this needs to be type foo not type foo[1u][1u] Error: this for ~this needs to be type foo not type foo[1u] // test.d struct foo { int foofoo; ~this() { // no error if explicit destructor not // defined } } class bar { foo fred; foo[2][2] foofoo; foo[1] frop; // this gives error foo[1][1] fropfrop; // this too } unittest { foo frop; foo[1][1] fropfrop; // this works bar burp; }
Comment #1 by k.hara.pg — 2011-06-19T17:12:10Z
Simple test case: ---- struct foo5574a { ~this() {} } class bar5574a { foo5574a[1] frop; } ---- Postblit has similar problem: ---- struct foo5574b { this(this){} } struct bar5574b { foo5574b[1] frop; } ----
Comment #2 by bugzilla — 2011-06-20T03:19:08Z