[Issue 12761] rvalue object with alias this to lvalue produces rvalue

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Oct 25 08:24:32 UTC 2018


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

RazvanN <razvan.nitu1305 at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |razvan.nitu1305 at gmail.com

--- Comment #1 from RazvanN <razvan.nitu1305 at gmail.com> ---
This bug report is invalid. Alias this creates a subtyping relation between S
and I and should behave as inheritance in the case of classes. Take this
example which represents the same pattern but in the case of classes:

class A {}
class B : A {}

void fun(ref A a) {}                                                            

void main()
{
    fun(new B());
}

You will get the same error: 

issue.d(8): Error: function issue.fun(ref A a) is not callable using argument
types (B)
issue.d(8):        cannot pass rvalue argument new B of type issue.B to
parameter ref A a

--


More information about the Digitalmars-d-bugs mailing list