Bug 2189 – bad alias declaration not reported as semantic error
Status
RESOLVED
Resolution
INVALID
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D1 (retired)
Platform
x86
OS
Windows
Creation time
2008-07-02T06:09:59Z
Last change time
2019-09-09T13:21:33Z
Keywords
accepts-invalid
Assigned to
No Owner
Creator
david
Comments
Comment #0 by davidl — 2008-07-02T06:09:59Z
class test
{
int c;
}
class test1
{
alias test.c d;
}
Comment #1 by razvan.nitu1305 — 2019-09-09T13:21:33Z
This bug report is invalid. `test.c` is a valid identifier and taking an alias to it is fine. For example:
class test1
{
alias test.c d;
void foo()
{
int a = d.offsetof;
}
}
If you use it like this:
class test1
{
alias test.c d;
void foo()
{
int a = d;
}
}
The you get the correct error: "need this for c of type int".
Closing as invalid.