[Issue 6519] New: [CTFE] Problem with inout

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Aug 17 07:47:01 PDT 2011


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

           Summary: [CTFE] Problem with inout
           Product: D
           Version: D2
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: bearophile_hugs at eml.cc


--- Comment #0 from bearophile_hugs at eml.cc 2011-08-17 07:46:59 PDT ---
D2 code:


inout(int[]) foo(inout int[] data) {
    return data;
}
void main() {
    enum int[] a = [1, 2];
    const r1 = foo(a); // OK
    enum r2 = foo(a); // Not OK
}



DMD 2.055beta gives:

test.d(7): Error: variable test2.main.r2 only fields, parameters or stack based
variables can be inout
test.d(7): Error: cannot evaluate foo([1,2]) at compile time

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