6749 – [CTFE] problem with array of structs

D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 6749 - [CTFE] problem with array of structs
Summary: [CTFE] problem with array of structs
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P2 normal
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
Reported: 2011年09月30日 13:00 UTC by Dmitry Olshansky
Modified: 2011年10月01日 14:14 UTC (History)
2 users (show)

See Also:


Attachments
failing test (2.05 KB, application/octet-stream)
2011年09月30日 13:01 UTC, Dmitry Olshansky
Details
Add an attachment (proposed patch, testcase, etc.)

Note You need to log in before you can comment on or make changes to this issue.
Description Dmitry Olshansky 2011年09月30日 13:00:03 UTC
Actually I'm not sure what's at fault here but at least I have a test case on R-T vs C-T behavior. Reduced from FReD static regex codegen, so the test case is rather convulted.
Summarizing it: during CTFE I built an array of structs containing string.
Somehow at CTFE I manage to get string at index 0 with same content as at index 1. At run-time they are of course different. Maybe it has something to do with to!string.
Tested on 2.055 and 2.056head running on linux 64, results are the same.
Comment 1 Dmitry Olshansky 2011年09月30日 13:01:11 UTC
Created attachment 1029 [details] 
failing test
Comment 2 Don 2011年09月30日 22:29:06 UTC
Reduced test case:
struct CtState {
 string code;
}
CtState bug6749()
{
 CtState[] pieces;
 CtState r = CtState("correct");
 pieces ~= r; 
 r = CtState("clobbered"); 
 return pieces[0];
}
static assert(bug6749().code == "correct");
Looks like a problem with appending structs.


AltStyle によって変換されたページ (->オリジナル) /