[Issue 16140] New: while(auto x = y) does not behave like if(auto x = y)

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Wed Jun 8 09:30:28 PDT 2016


https://issues.dlang.org/show_bug.cgi?id=16140

          Issue ID: 16140
           Summary: while(auto x = y) does not behave like if(auto x = y)
           Product: D
           Version: D2
          Hardware: x86
                OS: Mac OS X
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: meapineapple at gmail.com

While loops ought to support the same syntax as conditionals for assigning the
result of an expression to a value scoped to that loop.

void main(){
    if(auto value = 1){} // compiles
    while(auto value = 1){} // expression expected, not 'auto'
}

--


More information about the Digitalmars-d-bugs mailing list