The bizarre world of typeof()

Kagamin spam at here.lot
Mon Oct 26 07:50:56 PDT 2009


Denis Koroskin Wrote:

> > Lars T. Kyllingstad Wrote:
> >
> >>      // This one fails with the following hilarious message:
> >>      // Error: static assert  (is(real function() == function)) is false
> >>      static assert (is (typeof(&Foo.bar) == function));
> >
> > Failure is valid, compiler just can't show member function types  
> > correctly.
> 
> That's a correct behavior. &Foo.bar returns a *function*, not a delegate  
> (because of a lack of context), and  no type information is associated  
> with it.

Yes, the context is not *provided*, but is *required*.
*function* doesn't require context.



More information about the Digitalmars-d mailing list