www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 14353] New: SDC test0104.d fails under DMD

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

          Issue ID: 14353
           Summary: SDC test0104.d fails under DMD
           Product: D
           Version: unspecified
          Hardware: x86
                OS: Mac OS X
            Status: NEW
          Severity: normal
          Priority: P1
         Component: DMD
          Assignee: nobody puremagic.com
          Reporter: shammah.chancellor gmail.com

DMD fails with: 
test0104.d(12): Error: function test0104.T.add (int a) is not callable using
argument types ()


```test0104.d
//T compiles:yes
//T has-passed:yes
//T retval:42
// Test creation of delegates from member function.

struct S {
    int i;
    T t;

    auto add(int a) {
        t.i = a + i;
        return t.add;
    }
}

struct T {
    int i;
    int add(int a) {
        return i + a;
    }
}

int main() {
    S s;
    s.i = s.t.i = 1;
    auto dg1 = s.add;
    auto dg2 = dg1(34);
    return dg2(7);
}

```

--
Mar 28 2015