[Issue 4707] New: auto ref for foreach loops

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Aug 21 19:31:17 PDT 2010


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

           Summary: auto ref for foreach loops
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: dsimcha at yahoo.com


--- Comment #0 from David Simcha <dsimcha at yahoo.com> 2010-08-21 19:31:14 PDT ---
The following should be possible, with x being ref if possible and non-ref
otherwise.  I've toyed with the possibility of adding opApply support to some
stuff in std.range and std.algorithm and this is a blocker for doing it at all
properly.

void main() {
    foreach(auto ref x; [1, 2]) {}
}

test9.d(2): basic type expected, not auto
test9.d(2): no identifier for declarator int
test9.d(2): found 'auto' when expecting ';'
test9.d(2): found ';' when expecting ')'
test9.d(2): found ')' when expecting ';' following statement

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