On 07/03/13 17:11, John Colvin wrote: > On Wednesday, 3 July 2013 at 15:05:29 UTC, Timon Gehr wrote: >> On 07/03/2013 04:53 PM, John Colvin wrote: >>> On Wednesday, 3 July 2013 at 03:22:16 UTC, Jonathan M Davis wrote: >>>> That is _very_ broken IMHO. It makes no sense for parens to be >>>> optional with >>>> opCall. The whole point of opCall is to overload the parens! >>> >>> So much about optional parenthesis is broken. I really wish things >>> weren't going that way, it obfusticates the difference between a >>> callable and the result in a really nasty way, and it doesn't work for >>> function pointers (nor does UFCS unfortunately). >> >> Yes, UFCS works. > > struct A {} > > void foo(A a) {} > > void main() > { > A a; > auto foo_ptr = &foo; > a.foo_ptr(); //Error: undefined identifier 'foo_ptr' > a.foo_ptr; //Error: no property 'foo_ptr' for type 'A' > }
Move the "auto foo_ptr = &foo;" line outside of `main` and it'll work. UFCS has several problems that need to be fixed and this is just one of them, but it isn't function-pointer specific. artur