www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 6015] New: [CTFE] Strange behavior of assignment appears in a situation

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

           Summary: [CTFE] Strange behavior of assignment appears in a
                    situation
           Product: D
           Version: D2
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: youxkei gmail.com



---
struct Foo{
    string field;
}

bool func(string input){
    Foo foo;
    foo.field = input[0..$];
    assert(foo.field == "test");
    foo.field = "test2";//assignment1
    assert(foo.field == "test");//assertion1
    assert(foo.field == "test2");//assertion2
    return true;
}

static assert(func("test"));


This code doesn't work on dmd v2.053.
Somehow assertion1 succeeds and somehow assertion2 fails in CTFE.
This shows that assignment1 has wrong behavior.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 16 2011
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=6015


Don <clugdbug yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |clugdbug yahoo.com.au
         Resolution|                            |FIXED



https://github.com/D-Programming-Language/dmd/commit/669cafeb9fecc98d5f4689f379f638a9661f0b35

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