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

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 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