www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 24893] New: Member functions passed by AliasTemplateParameter

https://issues.dlang.org/show_bug.cgi?id=24893

          Issue ID: 24893
           Summary: Member functions passed by AliasTemplateParameter are
                    not callable
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: b2.temp gmx.com

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 --
Dec 11