```d
import std, core.lifetime;

struct Node {
    Node* pNext;
    void func() { "Node::func %s".writeln( pNext); }
}
void func( Node* p ) { "::func %s(%s)".writeln( p, p == null ? p : p.next); }

void main()
{
    Node n;
    auto pn = &n; //cast( Node* )0;
    pn.func(); // prints: Node::func
    // WTF?
// why called Node::func for Node* when ::func is right choice for it?
}
```

problem:
member func has invariant that **this** is not null (programmer thinks so). global func hasn't the one and programmer should check for it before doing something.

when pn is null u've got AccessViolation/Signal_11 with no stacktrace.

workaround:
avoid overloaded UFCS for pointers

Reply via email to