digitalmars.D.bugs - [Issue 18969] New: 'need this for <function>' when passing field or
- d-bugmail puremagic.com (26/26) Jun 11 2018 https://issues.dlang.org/show_bug.cgi?id=18969
https://issues.dlang.org/show_bug.cgi?id=18969 Issue ID: 18969 Summary: 'need this for <function>' when passing field or method as template parameter Product: D Version: D2 Hardware: x86 OS: Windows Status: NEW Severity: enhancement Priority: P1 Component: dmd Assignee: nobody puremagic.com Reporter: simen.kjaras gmail.com Consider this code: class C { int n; } void fun(alias fn)() {} unittest { C c = new C(); fun!(c.n)(); } Error message: foo.d(7): Error: need this for fun of type pure nothrow nogc safe void() What's actually needed here is for fun to get a context pointer, either to the unittest block or to the instance of C. --
Jun 11 2018