[Issue 24024] cannot pass class this to ref class

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Jul 5 09:23:31 UTC 2023


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

FeepingCreature <default_357-line at yahoo.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |default_357-line at yahoo.de

--- Comment #4 from FeepingCreature <default_357-line at yahoo.de> ---
I mean, in the extreme, if this was allowed, shouldn't this happen?

class C
{
    void mem()
    {
        foo(this);
    }
}

void foo(ref C c) { c = null; }

C c = new C;
c.mem;
assert(c is null);

And what about if `c` is genuinely an rvalue, such as `C createC();
createC.mem;`?

--


More information about the Digitalmars-d-bugs mailing list