Are there any default dmd optimizations

Walter Bright newshound2 at digitalmars.com
Thu Feb 28 15:01:43 PST 2013


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.



More information about the Digitalmars-d mailing list