[Issue 24024] New: cannot pass class this to ref class

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Jul 1 01:04:42 UTC 2023


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

          Issue ID: 24024
           Summary: cannot pass class this to ref class
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: major
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: bugzilla at digitalmars.com

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

void foo(ref C);

void test()
{
    C c;
    foo(c); // passes
}
-----------
test.d(5): Error: function `test.foo(ref C)` is not callable using argument
types `(C)`
test.d(5):        cannot pass rvalue argument `this` of type `test.C` to
parameter `ref C`

--


More information about the Digitalmars-d-bugs mailing list