Thread overview
[Issue 14632] Diagnostic improvement for invalid cast with alias this
Jun 09, 2018
Nick Treleaven
June 09, 2018
https://issues.dlang.org/show_bug.cgi?id=14632

Nick Treleaven <nick@geany.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |nick@geany.org

--- Comment #1 from Nick Treleaven <nick@geany.org> ---
Reduced:

struct Tuple(T...)
{
    alias Types = T;
    Types expand;
    alias expand this;
}

void test()
{
    Tuple!(int, int) point;
    auto newPoint = cast(Object)(point);
}

Error messages no longer use '__tup$n$' but could still be improved as per comment 0:

onlineapp.d(10): Error: cannot cast expression point.__expand_field_0 of type
int to object.Object
onlineapp.d(10): Error: cannot cast expression point.__expand_field_1 of type
int to object.Object

--
November 26, 2018
https://issues.dlang.org/show_bug.cgi?id=14632

--- Comment #2 from github-bugzilla@puremagic.com ---
Commit pushed to master at https://github.com/dlang/dmd

https://github.com/dlang/dmd/commit/4d4cd923df4401cf4aef4744c5c122adf8aeb631 Fix Issue 6777 and 14632 - alias this disables casting for classes

--
November 26, 2018
https://issues.dlang.org/show_bug.cgi?id=14632

github-bugzilla@puremagic.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--