Bug 10275 – CTFE: Allow const casts of struct literals

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-06-05T07:05:00Z
Last change time
2013-06-24T23:32:48Z
Assigned to
nobody
Creator
clugdbug

Comments

Comment #0 by clugdbug — 2013-06-05T07:05:36Z
This is allowed in const folding, but not in CTFE. ---------- struct Bug10275 { uint[] ivals; } Bug10275 bug10275() { return Bug10275([1,2,3]); } int test10275() { immutable(Bug10275) xxx = cast(immutable(Bug10275))bug10275(); return 1; } static assert(test10275()); ----------
Comment #1 by github-bugzilla — 2013-06-24T23:32:32Z
Commit pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/b92a1ff925c5194d714296dec177b92c70011c2c Fix bug 10275 CTFE: allow const casts of struct literals This was permitted in const-folding, but not in CTFE until now.