That's a bug. It should be using the function pointer.UFCS call should abide by the same scoping rules as anything else.https://issues.dlang.org/show_bug.cgi?id=14161
Moreover. If the function is not defined (only pointer), I get this error:
aa.d(5): Error: no property 'f' for type 'int' when try use 5.f();