digitalmars.D.bugs - [Issue 3198] New: wrong initializer for structs arrays
- d-bugmail puremagic.com (40/40) Jul 21 2009 http://d.puremagic.com/issues/show_bug.cgi?id=3198
- d-bugmail puremagic.com (20/20) Dec 30 2009 http://d.puremagic.com/issues/show_bug.cgi?id=3198
- d-bugmail puremagic.com (8/8) Dec 30 2009 http://d.puremagic.com/issues/show_bug.cgi?id=3198
- d-bugmail puremagic.com (9/9) Jan 06 2011 http://d.puremagic.com/issues/show_bug.cgi?id=3198
- d-bugmail puremagic.com (10/10) Jan 06 2011 http://d.puremagic.com/issues/show_bug.cgi?id=3198
- d-bugmail puremagic.com (6/6) Jan 21 2011 http://d.puremagic.com/issues/show_bug.cgi?id=3198
- d-bugmail puremagic.com (12/12) Feb 06 2011 http://d.puremagic.com/issues/show_bug.cgi?id=3198
http://d.puremagic.com/issues/show_bug.cgi?id=3198 Summary: wrong initializer for structs arrays Product: D Version: 1.046 Platform: x86 OS/Version: All Status: NEW Keywords: wrong-code Severity: major Priority: P2 Component: DMD AssignedTo: nobody puremagic.com ReportedBy: nfxjfg gmail.com The following example compiles, but the output is wrong. It seems the initializer for a struct array is ignored; instead, the default initializer of the struct is used for the array. import std.stdio; import std.string; struct T { int g = 1; string toString() { return format("%s", g); } } class Foo { int[5] x = 4; //this doesn't work //basically, the "=T(4)" part is ignored T[5] y = T(4); } void main() { auto f = new Foo(); //both lines should output the same //but it shows f.y is [1,1,1,1,1] writefln("f.x = %s", f.x); writefln("f.y = %s", f.y); } -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jul 21 2009
http://d.puremagic.com/issues/show_bug.cgi?id=3198 Don <clugdbug yahoo.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |patch CC| |clugdbug yahoo.com.au The bug clearly lies in todt.c, inside dt_t **TypeSArray::toDtElem(dt_t **pdt, Expression *e). If it's an array of structs, (ie, tbn->ty == Tstruct), then the 'e' value is completely ignored!! This is certainly wrong. Changing the two places where the check is: if (tbn->ty == Tstruct) into: if (tbn != e->type && tbn->ty == Tstruct) allows the test case to pass. But that may not be the correct criterion to use. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Dec 30 2009
http://d.puremagic.com/issues/show_bug.cgi?id=3198 Or else, create a new version of TypeStruct::toDtElem, which doesn't have the special-case for structs members, and call it from StructDeclaration::toDt() and ClassDeclaration::toDt2() -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Dec 30 2009
http://d.puremagic.com/issues/show_bug.cgi?id=3198 nfxjfg gmail.com changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |WONTFIX -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jan 06 2011
http://d.puremagic.com/issues/show_bug.cgi?id=3198 Brad Roberts <braddr puremagic.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |REOPENED CC| |braddr puremagic.com Resolution|WONTFIX | -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jan 06 2011
http://d.puremagic.com/issues/show_bug.cgi?id=3198 The patch for bug 1914 fixes this. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jan 21 2011
http://d.puremagic.com/issues/show_bug.cgi?id=3198 Don <clugdbug yahoo.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|REOPENED |RESOLVED Resolution| |FIXED Fixed https://github.com/D-Programming-Language/dmd/commit/0c7bd71609735814f5bb410f903e454643ac260f -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Feb 06 2011