www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 6749] New: [CTFE] problem with array of structs

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=6749

           Summary: [CTFE] problem with array of structs
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: dmitry.olsh gmail.com



13:00:03 PDT ---
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.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Sep 30 2011
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=6749




13:01:11 PDT ---
Created an attachment (id=1029)
failing test

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Sep 30 2011
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=6749


Don <clugdbug yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |clugdbug yahoo.com.au



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.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Sep 30 2011
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=6749


Walter Bright <bugzilla digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |bugzilla digitalmars.com
         Resolution|                            |FIXED



14:14:59 PDT ---
https://github.com/D-Programming-Language/dmd/commit/f680025e30b5423e2d2759e5c2f004cafb53e5ea

https://github.com/D-Programming-Language/dmd/commit/36d5b056a318698d392cc84db92282368092a533

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Oct 01 2011