[Issue 7473] New: [CTFE] Non-ref argument behaves as if it's a ref argument

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Feb 9 10:33:00 PST 2012


http://d.puremagic.com/issues/show_bug.cgi?id=7473

           Summary: [CTFE] Non-ref argument behaves as if it's a ref
                    argument
           Product: D
           Version: D2
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: youxkei at gmail.com


--- Comment #0 from Hisayuki Mima <youxkei at gmail.com> 2012-02-10 03:32:58 JST ---
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;
    }

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list