On 2/28/2013 11:03 AM, Timon Gehr wrote:
It's really easy. DMD can be convinced to do a sufficient conservative analysis even now, but the behaviour is undocumented and seems unintentional.void main() { void foo()() { bar(); } void bar()() { i = 3; } int i; foo(); }
No, the compiler is not being clever here, nor is this undocumented. Templates are not semantically analyzed until they are instantiated. In fact, they can't be semantically analyzed until they are instantiated.
