www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 17080] New: Can assign delegate to function

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

          Issue ID: 17080
           Summary: Can assign delegate to function
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: dlang supradigital.org

The following code compiles but according to my understanding, it shouldn't.

// 

module main;

struct Foo
{
    void myFunction ( int a ) {}
}

void main()
{
    void function ( int x ) func;

    func = &Foo.myFunction;
}

--
Jan 09