D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 2937 - postblit not called for foreach arg over array of structs
Summary: postblit not called for foreach arg over array of structs
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: x86 All
: P2 normal
Assignee: No Owner
URL:
Keywords: wrong-code
Depends on:
Blocks:
 
Reported: 2009-05-04 23:24 UTC by Cristi Vlasceanu
Modified: 2015-06-09 01:26 UTC (History)
1 user (show)

See Also:


Attachments
test case (182 bytes, text/plain)
2009-05-04 23:25 UTC, Cristi Vlasceanu
Details

Note You need to log in before you can comment on or make changes to this issue.
Description Cristi Vlasceanu 2009-05-04 23:24:27 UTC
The assertion fails in the following program (I was able to fix it in my back-end for .NET but it is probably best for a fix to go into the front-end).

struct X {
     int i;
     this(this) {
         ++i;
     }
}
void main() {
     X [1] xs;
     xs[0] = X();
     foreach(x; xs) {
         assert(x.i == 1);
     }
}
Comment 1 Cristi Vlasceanu 2009-05-04 23:25:44 UTC
Created attachment 349 [details]
test case
Comment 2 Gide Nwawudu 2009-05-06 03:35:32 UTC
Similar to BUG 2674.
Comment 3 Walter Bright 2009-09-03 13:36:16 UTC
Fixed dmd 2.032