[Issue 19738] New: std.range.choose assignment breaks @safe-ty
    d-bugmail at puremagic.com 
    d-bugmail at puremagic.com
       
    Fri Mar 15 04:54:01 UTC 2019
    
    
  
https://issues.dlang.org/show_bug.cgi?id=19738
          Issue ID: 19738
           Summary: std.range.choose assignment breaks @safe-ty
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: regression
          Priority: P1
         Component: phobos
          Assignee: nobody at puremagic.com
          Reporter: code at klickverbot.at
Introduced in https://github.com/dlang/phobos/pull/6904:
---
import std.range;
struct EvilRange {
    enum empty = true;
    int front;
    void popFront() @safe {}
    auto opAssign(const ref EvilRange other){
        *(cast(uint*)0xcafebabe) = 0xdeadbeef;
        return this;
    }
}
void main() @safe {
    auto c1 = choose(true, EvilRange(), EvilRange());
    auto c2 = c1;
    c1 = c2;
}
---
--
    
    
More information about the Digitalmars-d-bugs
mailing list