← Back to index
|
Original Bugzilla link
Bug 13297 – [CTFE] Modifications of user type pointer member passed by ref in function disappear
Status
RESOLVED
Resolution
FIXED
Severity
major
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2014-08-15T13:12:00Z
Last change time
2015-01-21T13:49:42Z
Keywords
CTFE, pull, wrong-code
Assigned to
nobody
Creator
verylonglogin.reg
Comments
Comment #0
by verylonglogin.reg — 2014-08-15T13:12:20Z
This code should compile fine: --- struct S { int* p; } void f(ref int* p) { p = cast(int*) 1; assert(p); // passes } void main() { static assert( { S s; f(s.p); return s.p == null; // false } ()); } ---
Comment #1
by k.hara.pg — 2015-01-20T11:55:45Z
(In reply to Denis Shelomovskij from comment #0) > This code should compile fine: > --- > struct S > { > int* p; > } > > void f(ref int* p) > { > p = cast(int*) 1; > assert(p); // passes > } > > void main() > { > static assert( > { > S s; > f(s.p); > return s.p == null; // false You meant: return s.p != null; // false ? > } ()); > } > ---
Comment #2
by verylonglogin.reg — 2015-01-20T13:28:26Z
(In reply to Kenji Hara from comment #1) > > You meant: > return s.p != null; // false > ? Yes, sorry.
Comment #3
by k.hara.pg — 2015-01-20T15:20:40Z
(In reply to Denis Shelomovskij from comment #2) > (In reply to Kenji Hara from comment #1) > > > > You meant: > > return s.p != null; // false > > ? > > Yes, sorry. OK, the CTFE issue is recently fixed by my CTFE engine cleanup.
https://github.com/D-Programming-Language/dmd/pull/4227
To avoid regression, will add a test case.
https://github.com/D-Programming-Language/dmd/pull/4319
Comment #4
by github-bugzilla — 2015-01-21T13:49:39Z
Commit pushed to master at
https://github.com/D-Programming-Language/dmd
https://github.com/D-Programming-Language/dmd/commit/0bc8cca5586e5bb060d237188db75d84184fa274
fix Issue 13297 - [CTFE] Modifications of user type pointer member passed by ref in function disappear Fixed in PR #4227 (22badb69bd07f013b96383ae4e07dd93cf12d115).