[Issue 14093] [REG2.065] __traits(compiles, cast(Object)(tuple)) is true even if it doesn't compile.

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Wed May 27 07:20:42 PDT 2015


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

Igor Stepanov <wazar.leollone at yahoo.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
                 CC|                            |wazar.leollone at yahoo.com
         Resolution|FIXED                       |---

--- Comment #6 from Igor Stepanov <wazar.leollone at yahoo.com> ---
This issue is not fully solved.
There is simpler example:
-----------------------------------------
struct FooBar
{
    int a;
    int b;
}

void test14093()
{
    FooBar foo;
    auto obj = cast(Object)foo; //e2ir: cannot cast foo of type FooBar to type
object.Object
}
-----------------------------------------
Moreover, I think, this issue is solved incorrectly: alias this mechanism
should reject `cast(Object)(point._tupleAliasThis_)` variant and continue
process the root casting "cast(Object)point" excluding alias this.
And result error message should be 
"Error: cannot cast expression point of type Tuple!(int, "x", int, "y") to
object.Object".
We are interested in subtyping (alias this, or inheritance) only when it can
done its work (casting, .member ...).

--


More information about the Digitalmars-d-bugs mailing list