Closed terencehill closed 3 years ago
This code compiles and when executed prints 4, but it shouldn't since k is defined inside the if block.
void print(string a) = #1; string ftos(float i) = #2; string strcat(string a, string b) = #10; void main() { if(1) float k = 4; print(strcat(ftos(k), "\n")); }
Adding curly braces around float k = 4; gmqcc correctly refuses to compile it.
float k = 4;
Compiled and executed with ./gmqcc -std=gmqcc -freturn-assignments idk.qc -o out.dat && ./qcvm out.dat
./gmqcc -std=gmqcc -freturn-assignments idk.qc -o out.dat && ./qcvm out.dat
Fixed in 1e8ce17
This code compiles and when executed prints 4, but it shouldn't since k is defined inside the if block.
Adding curly braces around
float k = 4;
gmqcc correctly refuses to compile it.Compiled and executed with
./gmqcc -std=gmqcc -freturn-assignments idk.qc -o out.dat && ./qcvm out.dat