Bug 18035 – super does not work properly for template base classes

Status
RESOLVED
Resolution
WORKSFORME
Severity
enhancement
Priority
P4
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2017-12-05T18:14:33Z
Last change time
2023-05-09T13:36:14Z
Keywords
rejects-valid
Assigned to
No Owner
Creator
Andrei Alexandrescu

Comments

Comment #0 by andrei — 2017-12-05T18:14:33Z
Consider: class A(T) { void fun() {} } class Aint { void fun() {} } class B : Aint { alias fun = super.fun; } class C : A!int { alias fun = super.fun; } The alias inside class C fails to compile with the error message: test.d(12): Error: identifier 'fun' of 'A.fun' is not defined The code should go through.
Comment #1 by razvan.nitu1305 — 2023-05-09T13:36:14Z
Today `super` is no longer usable in static contexts, therefore you get errors that `super.fun` is undefined. Using `typeof(super).fun` makes the code compile. Arguably, the error could be improved.