Andrei Alexandrescu wrote:
The analysis I discussed is a flow- and path-independent analysis. It
always terminates and produces conservative results (i.e. it associates
one Boolean with each function, not on each tuple of a function and
inputs. This is how the current compiler works - if you tried your
example, it will refuse to evaluate foo during compilation.
That's because there's an unrelated bug in it :-( Here's the corrected example:
import std.c.stdio;
int foo(int x, int y)
{
if (x == 3)
return y + 1;
printf("hello\n");
return 0;
}
const z = foo(3, 7);
The compiler does not work as you suggest it does.