[Issue 19117] Alias this messes up call to normal function
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Thu Jul 26 11:22:28 UTC 2018
https://issues.dlang.org/show_bug.cgi?id=19117
--- Comment #1 from RazvanN <razvan.nitu1305 at gmail.com> ---
(In reply to RazvanN from comment #0)
> struct A
> {
> immutable(A) fun() { return immutable A(); }
> ref A fun2(ref A a) { return this; }
>
>
> alias fun this; // line 6
> }
>
> void main()
> {
> A a, b;
> b.fun2(a);
> }
>
> aliasthisbug.d(12): Error: function aliasthisbug.A.fun2(ref A a) is not
> callable using argument types (A)
> aliasthisbug.d(12): cannot pass argument a of type A to parameter ref
> A a
>
> Comment line 6 an the error disappears.
Also, changing the signature of fun2 to : ref A fun2(A a) makes the example
compile
--
More information about the Digitalmars-d-bugs
mailing list