You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The following program should compile successfully:
```class A{ void f(){}}class B : A{ override void f() { alias Fun = A.f; test!(Fun)(this); // same errors test!(A.f)(this); test!(super.f)(this); }}void test(alias Fun)(A a){ Fun(a); a.Fun();}void main(){ (new B).f();} ```
instead we got the following errors
> /tmp/temp_7F594F16A2D0.d(20,8): Error: function `f` is not callable using argument types `(A)`
/tmp/temp_7F594F16A2D0.d(20,8): expected 0 argument(s), not 1
/tmp/temp_7F594F16A2D0.d(3,10): `temp_7F594F16A2D0.A.f()` declared here
/tmp/temp_7F594F16A2D0.d(21,6): Error: no property `Fun` for `a` of type `temp_7F594F16A2D0.A`
/tmp/temp_7F594F16A2D0.d(1,1): class `A` defined here
/tmp/temp_7F594F16A2D0.d(11,9): Error: template instance `temp_7F594F16A2D0.test!(f)` error instantiating
The text was updated successfully, but these errors were encountered:
A more reasonable test case, with no virtual calls and also no invalid syntax (Fun(a) is not supposed to work in D)
```class A{ final void af(){}}class B : A{ final void bf() { alias Fun = A.af; test!(Fun)(this); // same errors test!(A.af)(this); test!(super.af)(this); }}void test(alias Fun)(A a){ a.Fun();}void main(){ (new B).bf();} ```
classA
{
final voidaf(){}
}
classB : A
{
final voidbf()
{
alias Fun = A.af;
test!(Fun)(this);
// same errors
test!(A.af)(this);
test!(super.af)(this);
}
}
voidtest(alias Fun)(A a)
{
a.Fun();
}
voidmain()
{
(new B).bf();
}
output
/tmp/temp_7F595F4F6A10.d(20,6): Error: no property Fun for a of type temp_7F595F4F6A10.A
/tmp/temp_7F595F4F6A10.d(1,1): class A defined here
/tmp/temp_7F595F4F6A10.d(11,9): Error: template instance temp_7F595F4F6A10.test!(af) error instantiating
basile-z reported this on 2024-12-12T02:57:12Z
Transferred from https://issues.dlang.org/show_bug.cgi?id=24893
Description
The text was updated successfully, but these errors were encountered: