On 01/20/2013 03:59 AM, Ali Çehreli wrote:
On 01/19/2013 06:41 PM, Ali Çehreli wrote:

 > class Engine
 > {
 > static bindActors(Actor, string pattern)
 >     {
 >         writefln(" Binding actor with pattern %s", pattern);
 >     }
 > }

How come that function compiles without a return type? The following is
a bug, right?

class C
{
     static foo()  // <-- no return type; void is assumed
     {}
}

void main()
{
     static assert(is(typeof(C.foo()) == void));
}

Ali


Not a bug. This is function return type deduction. If you return something from foo, then the return type will change. What is often missed is that 'auto' does not mean anything. It exists just to make the parser happy.

Reply via email to