www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 16140] New: while(auto x = y) does not behave like if(auto x

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 puremagic.com
          Reporter: meapineapple 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'
}

--
Jun 08 2016