Issue 17123 - [REG 2.073] Issues with return @safe inference
Summary: [REG 2.073] Issues with return @safe inference
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P1 regression
Assignee: No Owner
URL:
Keywords: safe
Depends on:
Blocks:
 
Reported: 2017-01-26 13:41 UTC by Dicebot
Modified: 2017-02-24 20:34 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Dicebot 2017-01-26 13:41:22 UTC
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()
Comment 1 Walter Bright 2017-01-27 19:06:39 UTC
Reduces to:

void main()
{
    char[256] buffer;

    char[] delegate() read = () {
        return buffer[];
    };
}
Comment 2 Walter Bright 2017-01-28 05:10:07 UTC
https://github.com/dlang/dmd/pull/6495
Comment 3 Walter Bright 2017-01-29 10:35:06 UTC
Pull for the stable branch:

https://github.com/dlang/dmd/pull/6497
Comment 4 github-bugzilla 2017-01-29 14:14:28 UTC
Commits pushed to stable at https://github.com/dlang/dmd

https://github.com/dlang/dmd/commit/74f7a29935fe55a718a7bb92248e3c455bb4e105
fix Issue 17123 - [REG 2.073] Issues with return @safe inference

https://github.com/dlang/dmd/commit/dc279ec2003e4f4847fc9ebe1713bb99a2da99d9
Merge pull request #6497 from WalterBright/fix1707-stable

fix Issue 17123 - [REG 2.073] Issues with return @safe inference
Comment 5 github-bugzilla 2017-02-01 07:25:42 UTC
Commits pushed to master at https://github.com/dlang/dmd

https://github.com/dlang/dmd/commit/74f7a29935fe55a718a7bb92248e3c455bb4e105
fix Issue 17123 - [REG 2.073] Issues with return @safe inference

https://github.com/dlang/dmd/commit/dc279ec2003e4f4847fc9ebe1713bb99a2da99d9
Merge pull request #6497 from WalterBright/fix1707-stable
Comment 6 github-bugzilla 2017-02-12 15:13:39 UTC
Commit pushed to master at https://github.com/dlang/dmd

https://github.com/dlang/dmd/commit/7dd10aaf145981ce994e17abece5d90765222625
fix Issue 17123 - [REG 2.073] Issues with return @safe inference
Comment 7 github-bugzilla 2017-02-24 20:34:28 UTC
Commits pushed to newCTFE at https://github.com/dlang/dmd

https://github.com/dlang/dmd/commit/74f7a29935fe55a718a7bb92248e3c455bb4e105
fix Issue 17123 - [REG 2.073] Issues with return @safe inference

https://github.com/dlang/dmd/commit/dc279ec2003e4f4847fc9ebe1713bb99a2da99d9
Merge pull request #6497 from WalterBright/fix1707-stable

https://github.com/dlang/dmd/commit/7dd10aaf145981ce994e17abece5d90765222625
fix Issue 17123 - [REG 2.073] Issues with return @safe inference