Bug 22530 – Explicit cast between classes incorrectly goes through 'alias this' inside CTFE
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2021-11-21T03:47:49Z
Last change time
2021-12-14T10:34:28Z
Keywords
pull
Assigned to
No Owner
Creator
Boris Carvajal
Comments
Comment #0 by boris2.9 — 2021-11-21T03:47:49Z
test:
class D { }
class C
{
D y = new D();
alias y this;
}
void main()
{
static assert(cast(D)(new C) is null); // fails
assert(cast(D)(new C) is null); // runtime version is OK
}
Comment #1 by dlang-bot — 2021-11-21T04:05:15Z
@BorisCarvajal created dlang/dmd pull request #13332 "Fix Issue 22530 - Explicit cast between classes incorrectly goes through 'alias this' inside CTFE" fixing this issue:
- Fix Issue 22530 - Explicit cast between classes incorrectly goes through 'alias this' inside CTFE
https://github.com/dlang/dmd/pull/13332
Comment #2 by dlang-bot — 2021-11-21T13:47:42Z
dlang/dmd pull request #13332 "Fix Issue 22530 - Explicit cast between classes incorrectly goes through 'alias this' inside CTFE" was merged into stable:
- fcea221e0be0dc21b1703158718466baae90ed3d by Boris Carvajal:
Fix Issue 22530 - Explicit cast between classes incorrectly goes through 'alias this' inside CTFE
https://github.com/dlang/dmd/pull/13332
Comment #3 by dlang-bot — 2021-12-14T10:34:28Z
dlang/dmd pull request #13421 "merge stable" was merged into master:
- 43f1d040d9c94cc582816e977d7cba2838739f0f by Boris Carvajal:
Fix Issue 22530 - Explicit cast between classes incorrectly goes through 'alias this' inside CTFE (#13332)
https://github.com/dlang/dmd/pull/13421