April 25, 2021 [Issue 21862] New: Taking address of non-static method without "this" should not be allowed | ||||
|---|---|---|---|---|
| ||||
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: nobody@puremagic.com Reporter: eyal@weka.io 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! } -- | ||||
Copyright © 1999-2021 by the D Language Foundation
Permalink
Reply