[Issue 8189] New: const ref foreach iteration too

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Jun 3 03:47:42 PDT 2012


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

           Summary: const ref foreach iteration too
           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 2012-06-03 03:49:37 PDT ---
void foo(const ref int x) {} // OK
void main() {
    int x = 1;
    foo(x);
    const(int)[] array;
    foreach (ref const int i; array) {} // OK
    foreach (const ref int i; array) {} // error
}


DMD 2.060alpha, after Issue 3290 :

test.d(7): Error: basic type expected, not ref
test.d(7): Error: no identifier for declarator const(int)
test.d(7): Error: found 'ref' when expecting ';'
test.d(7): Error: found 'i' when expecting '.' following int
test.d(7): Error: found ';' when expecting identifier following 'int.'
test.d(7): Error: found 'array' when expecting ')'
test.d(7): Error: found ')' instead of statement
test.d(8): Error: unrecognized declaration

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