refactoring to check the type is template
check semantics of type of return statement

- check specified and deduced return type
- check return type of procedure. () is only allowed as return type of procedure