Functions in templates may still need a static chain

isnested==false for a template instance only means that the template
instance does not have nested parameters from the instantiation
scope (e.g. alias parameters). But it can still use variables from
it's declaration scope.
So we can only assume that a function in a template doesn't need
a static chain if we additionally check that the template's
parent is a module.
Nested structs may need static chains as well

The old code only checked for nested classes, but nested structs
may also need a static chain. Also a nested chain must propagate
through template instances.
Must handle 'degenerate closures'

Those are constructs that would need to be closures if they had escaped
local variables. As they don't escape local variables we can save the
frame pointer and don't need to make them a real closure. At the same
time we can never set a static chain for those functions as they can
be called from outside.
Nested template instance function must be weak/one-only

With the last commits it's now possible to have nested functions
which are also template instances (see runnable/gdc.d test). This
means we have to make those nested functions weak to make sure
they get merged with other template instances. The check in
d-objfile prevented exactly this case from working. It's unclear
if the check is still needed at all as it was written for an old
gcc version. The test suite shows no regressions when removing it.
Add test cases for issue 35

The last commits also fixed issue 35.
Merge pull request #48 from jpf91/fixChain

Fix static chain issues