Forward declaration inside Function block, no error?

Benjamin Thaut code at benjamin-thaut.de
Sun Jan 6 18:38:44 UTC 2019


Today I found a bug in my D code.


import std.stdio;

// Type your code here, or load an example.
void grow()
{
     writeln("grow");
}

void someFunc(bool condition)
{
     if(condition)
     {
         void grow();
     }
}


I tried to call the grow function, but accidentially copied the 
return value alongside the function name. I was wondering why 
this code compiles without errors. the "void grow();" becomes a 
no-op. In my opinion this could should not compile. Am I missing 
something here?

Kind Regards
Benjamin Thaut


More information about the Digitalmars-d-learn mailing list