Issue 8504 - Template attribute inferrence doesn't work

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

While template function body semantic, function type and its mangled name are not yet reflected the attribute inference. After semantic3 done, its type and mangled name will be fixed to actual ones.

This change is based on <del>#544</del> (merged).