Bug 6015 – [CTFE] Strange behavior of assignment appears in a situation

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
x86
OS
Windows
Creation time
2011-05-16T00:45:00Z
Last change time
2011-05-18T21:24:46Z
Assigned to
nobody
Creator
youxkei

Comments

Comment #0 by youxkei — 2011-05-16T00:45:47Z
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.
Comment #1 by clugdbug — 2011-05-18T21:24:46Z