Thread overview
[Issue 14093] [REG2.065] __traits(compiles, cast(Object)(tuple)) is true even if it doesn't compile.
[Issue 14093] __traits(compiles, cast(Object)(tuple)) is true even if it doesn't compile.
Jan 31, 2015
Pierre krafft
Feb 06, 2015
Walter Bright
Feb 08, 2015
Kenji Hara
May 27, 2015
Igor Stepanov
May 30, 2015
Kenji Hara
Jun 01, 2015
Kenji Hara
January 31, 2015
https://issues.dlang.org/show_bug.cgi?id=14093

Pierre krafft <kpierre+dlang@outlook.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |kpierre+dlang@outlook.com

--
February 01, 2015
https://issues.dlang.org/show_bug.cgi?id=14093

sinkuupump@gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |sinkuupump@gmail.com
           Hardware|x86_64                      |All
            Summary|__traits(compiles,          |[REG2.065]
                   |cast(Object)(tuple)) is     |__traits(compiles,
                   |true even if it doesn't     |cast(Object)(tuple)) is
                   |compile.                    |true even if it doesn't
                   |                            |compile.
                 OS|Linux                       |All

--- Comment #1 from sinkuupump@gmail.com ---
Introduced in https://github.com/D-Programming-Language/dmd/pull/3009

(In reply to Pierre krafft from comment #0)
> The code compiles if I run it in DPaste version "DMD 2.x Git (cfb5842b49)".

commit cfb5842b49 seems to be DMD 2.063.x.

--
February 06, 2015
https://issues.dlang.org/show_bug.cgi?id=14093

Walter Bright <bugzilla@digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bugzilla@digitalmars.com

--- Comment #2 from Walter Bright <bugzilla@digitalmars.com> ---
The error:

foo2.d(8): Error: e2ir: cannot cast __tup1850.__expand_field_0 of type int to
type object.Object
foo2.d(8): Error: e2ir: cannot cast __tup1850.__expand_field_1 of type int to
type object.Object

is coming from the glue layer. The __traits(compiles, ) does not get that far. The error check needs to be moved up into the front end to fix it.

--
February 08, 2015
https://issues.dlang.org/show_bug.cgi?id=14093

Kenji Hara <k.hara.pg@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull, rejects-valid

--- Comment #3 from Kenji Hara <k.hara.pg@gmail.com> ---
https://github.com/D-Programming-Language/dmd/pull/4395

--
February 11, 2015
https://issues.dlang.org/show_bug.cgi?id=14093

github-bugzilla@puremagic.com changed:

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

--
February 11, 2015
https://issues.dlang.org/show_bug.cgi?id=14093

--- Comment #4 from github-bugzilla@puremagic.com ---
Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/1d0268e92e83ec62f0daa548e39c749902e7eb54
fix Issue 14093 - __traits(compiles, cast(Object)(tuple)) is true even if it
doesn't compile.

Move invalid cast check into Expression::castTo().

https://github.com/D-Programming-Language/dmd/commit/132dcccc5f29732301250ea1a1684b858cf6f555 Merge pull request #4395 from 9rnsr/fix14093

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

--
February 21, 2015
https://issues.dlang.org/show_bug.cgi?id=14093

--- Comment #5 from github-bugzilla@puremagic.com ---
Commits pushed to https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/1d0268e92e83ec62f0daa548e39c749902e7eb54
fix Issue 14093 - __traits(compiles, cast(Object)(tuple)) is true even if it
doesn't compile.

https://github.com/D-Programming-Language/dmd/commit/132dcccc5f29732301250ea1a1684b858cf6f555 Merge pull request #4395 from 9rnsr/fix14093

--
May 27, 2015
https://issues.dlang.org/show_bug.cgi?id=14093

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

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

--- Comment #6 from Igor Stepanov <wazar.leollone@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 ...).

--
May 30, 2015
https://issues.dlang.org/show_bug.cgi?id=14093

--- Comment #7 from Kenji Hara <k.hara.pg@gmail.com> ---
(In reply to Igor Stepanov from comment #6)
> 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
> }
> -----------------------------------------

Will be fixed by: https://github.com/D-Programming-Language/dmd/pull/4691

> 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 ...).

It's rather diagnostic issue. I opened a new minor issue 14632.

--
June 01, 2015
https://issues.dlang.org/show_bug.cgi?id=14093

Kenji Hara <k.hara.pg@gmail.com> changed:

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

--- Comment #8 from Kenji Hara <k.hara.pg@gmail.com> ---
(In reply to Kenji Hara from comment #7)
> Will be fixed by: https://github.com/D-Programming-Language/dmd/pull/4691

It was merged: https://github.com/D-Programming-Language/dmd/commit/185779938ac17bfe412f390b4971daeb07d057bd

--