[Issue 15191] DIP25: Taking address of ref return is not type checked soundly

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Wed Jun 29 22:44:17 PDT 2016


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

--- Comment #1 from Walter Bright <bugzilla at digitalmars.com> ---
Reformatting for readability:

enum N=100;

ref int[N] foo(return ref int[N] s)@safe
{
    return s;
}

int[N]* bar(return ref int[N] s) @safe
{
    return &foo(s);
}

ref int[N] baz()@safe
{
    int[N] s;
    return *bar(s);
}

void bang(ref int[N] x) @safe
{
    x[]=0x25BAD;
}

void main() @safe
{
    bang(baz());
}

--


More information about the Digitalmars-d-bugs mailing list