Bug 17684 – [REG 2.062] `static alias this` bug or incomplete implementation?
Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2017-07-25T12:56:33Z
Last change time
2019-03-29T18:03:22Z
Assigned to
No Owner
Creator
Mike Franklin
Comments
Comment #0 by slavo5150 — 2017-07-25T12:56:33Z
Consider the following code:
import std.stdio;
struct StaticStruct
{
static int X;
static alias X this;
}
struct InstanceStruct
{
int X;
alias X this;
}
void main()
{
StaticStruct = 5; // Exhibit A: No Error
int V = StaticStruct; // Exhibit B: Error: type StaticStruct has no value
InstanceStruct s;
s = 5;
int v = s;
}
`static alias this` does not work in the same manner as `alias this`, only with static members.
If you believe `static alias this` is not a valid feature, then Exhibit A should not compile.
If you believe `static alias this` is a valid feature, then Exhibit B should compile and work.
Either way it's a bug.
Comment #1 by dlang-bugzilla — 2017-07-26T10:00:00Z
dlang/dmd pull request #9513 "Fix Issue 17684 - [REG 2.062] static alias this (Part 6)" was merged into master:
- 15bc4f98a0fe6f20f985d2b25fcdeefab0422b34 by JinShil:
Fix Issue 17684 - [REG 2.062] static alias this (Part 6)
https://github.com/dlang/dmd/pull/9513