On 10/2/2016 4:57 PM, Jacob wrote:
While on the subject, taking the address of a struct's method returns an
incorrect type that allows it to be called incorrectly even with @safe. Which is
a bit ironic cause then it can't be cast'd to a type that is actually safe to 
use.

    auto func = &SomeStruct.someFunc;
    func(); // ops runtime error, allows calling function that needs an object


Please file bugzilla issues for these sorts of things. Thanks!

> C++ makes this a pointer to a member function which looks like: "void
> (SomeStruct::*)()" for the example above. Either way for safety and just 
having
> a defined way to call a pointer to a member function would be nice.

http://digitalmars.com/articles/b68.html

Reply via email to