]> git.xonotic.org Git - xonotic/gmqcc.git/blob - tests/pointlife.qc
added a testcase for -Olocal-temps
[xonotic/gmqcc.git] / tests / pointlife.qc
1 void print(...) = #1;
2
3 var float foo = 0;
4
5 void funcall() {}
6 void bar(string) {}
7
8 void main(string str) {
9         string pl;
10
11         if (foo)
12                 return; // this is a block wher 'str' doesn't live
13                         // so the point-life will not overlap with str
14         pl = "Got overwritten!\n"; // pl point-life
15
16         print(str);
17
18         pl = "Kill the lifrange here"; // pl life stops
19         funcall(); // Now lock pl in case we have -Oglobal-temps
20         bar(pl); // pl life starts here now
21 }