[Issue 19809] New: `override` block affects passing lambda as argument
    d-bugmail at puremagic.com 
    d-bugmail at puremagic.com
       
    Tue Apr 16 13:25:55 UTC 2019
    
    
  
https://issues.dlang.org/show_bug.cgi?id=19809
          Issue ID: 19809
           Summary: `override` block affects passing lambda as argument
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: edi33416 at gmail.com
I'm having issues with the following code
```
mixin template Impl(M...)
{
    int opCmp(Object o) { return 0; }
}
class C
{
    override
    {
        mixin Impl!("x", "y", ((int x) => &x + 1));
    }
}
```
This gives me the error:
Error: delegate `t.C.__lambda2` cannot override a non-virtual function
This should compile.
Contrasting, the following code compiles just fine
```
class B
{
    void foo(int function(int) fp) {}
}
class C : B
{
    override
    {                                                                           
        void foo(int function(int) fp = (int x) => x) {}
    }
}
```
--
    
    
More information about the Digitalmars-d-bugs
mailing list