Bug 14348 – typeof(x).ident is not accepted as a symbol
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2015-03-27T10:14:00Z
Last change time
2015-06-17T21:03:17Z
Keywords
pull, rejects-valid
Assigned to
nobody
Creator
yebblies
Comments
Comment #0 by yebblies — 2015-03-27T10:14:39Z
I don't see any reason why this shouldn't work:
class B
{
int foo() { return 0; }
}
class C : B
{
override int foo() { return 1; }
alias superfoo = typeof(super).foo;
alias thisfoo = typeof(this).foo;
}
void main()
{
assert(&B.foo is &C.superfoo);
assert(&C.foo is &C.thisfoo);
}
The current implementation requires the typeof(a).b expression evaluates to both a type and a symbol, when only a symbol is required.