Bug 7473 – [CTFE] Non-ref argument behaves as if it's a ref argument

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
x86
OS
Windows
Creation time
2012-02-09T10:32:00Z
Last change time
2015-06-09T05:11:52Z
Keywords
CTFE, pull, wrong-code
Assigned to
clugdbug
Creator
youxkei

Comments

Comment #0 by youxkei — 2012-02-09T10:32:58Z
The following code cannot be compiled by dmd v2.057 and v2.058(DEBUG). struct S{ int i; } static assert({ S s = S(1); assert(s.i == 1); fun(s); assert(s.i == 1); // fails!! return true; }()); void fun(S s){ s.i = 2; }
Comment #1 by clugdbug — 2012-02-10T04:52:29Z
Not a regression - failed on D1.072.
Comment #2 by bugzilla — 2012-02-24T13:18:09Z
Comment #3 by github-bugzilla — 2012-02-24T13:18:52Z
Commit pushed to dmd-1.x at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/74a20d1ecddf6a677e73a08d2970db18856e49e5 fix Issue 7473 - [CTFE] Non-ref argument behaves as if it's a ref argument