Bug 6749 – [CTFE] problem with array of structs

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2011-09-30T13:00:00Z
Last change time
2011-10-01T14:14:59Z
Assigned to
nobody
Creator
dmitry.olsh

Attachments

IDFilenameSummaryContent-TypeSize
1029test_case.dfailing testapplication/octet-stream2099

Comments

Comment #0 by dmitry.olsh — 2011-09-30T13:00:03Z
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 by dmitry.olsh — 2011-09-30T13:01:11Z
Created attachment 1029 failing test
Comment #2 by clugdbug — 2011-09-30T22:29:06Z
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.
Comment #3 by bugzilla — 2011-10-01T14:14:59Z