www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 17123] New: [REG 2.073] Issues with return safe inference

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

          Issue ID: 17123
           Summary: [REG 2.073] Issues with return  safe inference
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: regression
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: public dicebot.lv

Several compilation issues in https://github.com/jacob-carlborg/dstep because
of attribute inference + return

Most simple example:

---
void main ()
{
    import std.socket;
    auto f = new TcpSocket;

    char[256] buffer;

    char[] delegate() read = () {
        size_t num = f.receive(buffer);
        return buffer[0 .. num];
    };
}
---

sample.d(8): Error: cannot implicitly convert expression (__lambda1) of type
char[] delegate() return  safe to char[] delegate()
sample.d(8): Error: cannot implicitly convert expression (__lambda1) of type
char[] delegate() return  safe to char[] delegate()

--
Jan 26 2017