[Issue 14619] foreach implicitly slices ranges
    d-bugmail at puremagic.com 
    d-bugmail at puremagic.com
       
    Wed Feb 24 18:33:48 UTC 2021
    
    
  
https://issues.dlang.org/show_bug.cgi?id=14619
Dennis <dkorpel at live.nl> changed:
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dkorpel at live.nl
--- Comment #4 from Dennis <dkorpel at live.nl> ---
I was surprised today that opSlice() / opIndex() even worked at all to make a
struct foreach-able. I looked at the spec, and couldn't find anything:
https://dlang.org/spec/statement.html#foreach-statement
https://dlang.org/spec/operatoroverloading.html#slice
So aside from the behavior, the documentation should also be updated.
Btw, the responsible code is currently here:
https://github.com/dlang/dmd/blob/4522e0236f2abde017c3ec1192f76c6cf661b7c2/src/dmd/opover.d#L1521
--
    
    
More information about the Digitalmars-d-bugs
mailing list