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

D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 7473 - [CTFE] Non-ref argument behaves as if it's a ref argument
Summary: [CTFE] Non-ref argument behaves as if it's a ref argument
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: x86 Windows
: P2 normal
Assignee: Don
URL:
Keywords: CTFE, pull, wrong-code
Depends on:
Blocks:
Reported: 2012年02月09日 10:32 UTC by Hisayuki Mima
Modified: 2015年06月09日 05:11 UTC (History)
2 users (show)

See Also:


Attachments
Add an attachment (proposed patch, testcase, etc.)

Note You need to log in before you can comment on or make changes to this issue.
Description Hisayuki Mima 2012年02月09日 10:32:58 UTC
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 Don 2012年02月10日 04:52:29 UTC
Not a regression - failed on D1.072.
Comment 2 Walter Bright 2012年02月24日 13:18:09 UTC
https://github.com/D-Programming-Language/dmd/pull/761 
Comment 3 github-bugzilla 2012年02月24日 13:18:52 UTC
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


AltStyle によって変換されたページ (->オリジナル) /