www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 8189] New: const ref foreach iteration too

reply d-bugmail puremagic.com writes:
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 puremagic.com
        ReportedBy: bearophile_hugs eml.cc



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: -------
Jun 03 2012
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8189




In a related issue I reported:


void main() {
    const(int)[] array;
    foreach (const i; array) {}
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jun 03 2012
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8189


bearophile_hugs eml.cc changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |WORKSFORME



This was fixed time ago.

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