"Mehrdad" <wfunct...@hotmail.com> wrote in message news:ifswigmcenyryxzyv...@forum.dlang.org... > On Friday, 18 May 2012 at 18:59:23 UTC, Steven Schveighoffer wrote: >> On Fri, 18 May 2012 14:30:46 -0400, Andrei Alexandrescu >> <seewebsiteforem...@erdani.org> wrote: >> >>> On 5/18/12 1:22 PM, Mehrdad wrote: >>>> My brain just exploded. >>>> Can someone explain what's going on? >>>> >>>> class Test >>>> { >>>> public void foo() { } >>>> } >>>> >>>> static assert(is(typeof(&Test.foo) == void function())); >>> >>> Looks like a bug. The assert should pass only if foo were static. >> >> No, this is not a bug. >> >> The purpose is so you can get the function pointer portion of a delegate >> without an instance of the object. > > I actually realized that might be the reason before I reported this, but > then I thought: > > In that case, shouldn't the 'this' parameter be explicitly part of the > function (at the end of the parameter list)?
No, that won't work in all cases due to the ordering of parameters, 'this' and the hidden struct pointer.