[Issue 8649] New: Not accepted "const ref Type" in foreach

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Sep 13 04:11:50 PDT 2012


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

           Summary: Not accepted "const ref Type" in foreach
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: rejects-valid
          Severity: minor
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: bearophile_hugs at eml.cc


--- Comment #0 from bearophile_hugs at eml.cc 2012-09-13 04:12:08 PDT ---
void foo(ref const int x) {} // OK
void bar(const ref int x) {} // OK
void main() {
    foreach (ref const int x; [1, 2, 3]) {} // OK
    foreach (const ref int x; [1, 2, 3]) {} // error
}


DMD 2.061alpha gives:

test.d(5): Error: basic type expected, not ref
test.d(5): Error: no identifier for declarator const(int)
test.d(5): Error: found 'ref' when expecting ';'
test.d(5): Error: found 'x' when expecting '.' following int
test.d(5): Error: found ';' when expecting identifier following 'int.'

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