I found the test case link14541.d completely baffling. The comment says "If instantiated contexts are different" but the whole idea is that templates in different contexts have different instantiations. This makes no sense. It should give an appropriate forward reference error. Likely the whole PR #4814 should be reverted as it makes no sense.