[Repost] Issue 8220 - invalid function call not detected during semantic analysis

http://d.puremagic.com/issues/show_bug.cgi?id=8220

This pull is identical to #1000. @WalterBright reverted #1000, because of the breaking of test case that he has, but I think it is genuinely invalid code (<a href="http://d.puremagic.com/issues/show_bug.cgi?id=8220#c4">my comment</a>).