https://issues.dlang.org/show_bug.cgi?id=21862
Issue ID: 21862
Summary: Taking address of non-static method without "this"
should not be allowed
Product: D
Version: D2
Hardware: x86_64
OS: Linux
Status: NEW
Severity: major
Priority: P1
Component: dmd
Assignee: [email protected]
Reporter: [email protected]
This should *not* compile, &S.m needs 'this' which is not available there:
struct S {
int m(int x) {return x;}
}
void main() {
int function(int) func = &S.m;
writeln(func(5)); // does not print 5!
}
--