Hi,

We recently got a bug report for the GCC D compiler frontend which shows that we
currently don't inline any templated functions. The reason seems to be that
decl_replaceable_p always returns true for D template functions.

We currently just mark such template function instances using make_decl_one_only
but this seems to prevent inlining. I've tried to set DECL_COMDAT additionally
and this fixes the inlining problem. Unfortunately it also leads to many
undefined reference errors as we probably don't generate the template instances
in all translation units as we should.

So what's the best/preferred way to put out template function instances so that:
* Instances in different objects files are merged
* GCC can still inline such functions
* Force the instances to be put out, even if they seem to be not used

How does the C++ frontend handle this?

Thanks,

Johannes.

Reply via email to