Bug 5840 – Cannot assign to an array member of struct in CTFE

Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
Other
OS
Mac OS X
Creation time
2011-04-13T01:31:00Z
Last change time
2011-04-30T11:30:30Z
Keywords
rejects-valid
Assigned to
nobody
Creator
kennytm

Comments

Comment #0 by kennytm — 2011-04-13T01:31:50Z
(This is a bug regarding the trunk version of DMD (commit ea65289). The following code works fine in 2.052.) In the latest version of DMD on github, assigning to an array member of a struct in compile-time is rejected. ----------------- struct Foo { string g; } Foo f() { Foo x; x.g = "y"; // Error: x.g = "y" cannot be evaluated at compile time return x; } pragma(msg, f()); ----------------- This causes tuple of string cannot be created in compile-time. The struct literal `Foo("y")` works though.
Comment #1 by kennytm — 2011-04-26T07:22:07Z
Comment #2 by bugzilla — 2011-04-30T10:42:13Z
Comment #3 by bugzilla — 2011-04-30T11:30:30Z