You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
Template generator produces invalid code in languages that don't allow shadowing and use a loop variable that is named the same as one of the names in the stub generator. Currently this only affects C++, but as more languages get added some of them will likely have similar issues.
To Reproduce
$ echo'loopline N i:int'| clash generate-stub cpp --from-file -#include <iostream>#include <string>#include <vector>#include <algorithm>using namespace std;int main() { for (int i = 0; i < n; i++) { int i; cin >> i; cin.ignore(); } return 0;}
$ echo'loopline N i:int'| clash generate-stub cpp --from-file - | gcc -x c++ -fsyntax-only -<stdin>: In function ‘int main()’:<stdin>:10:25: error: ‘n’ was not declared in this scope<stdin>:11:13: error: redeclaration of ‘int i’<stdin>:10:14: note: ‘int i’ previously declared here
CodinGame itself suffers from the exact same issue so we don't have plans to fix this on our side either.
The text was updated successfully, but these errors were encountered:
Describe the bug
Template generator produces invalid code in languages that don't allow shadowing and use a loop variable that is named the same as one of the names in the stub generator. Currently this only affects C++, but as more languages get added some of them will likely have similar issues.
To Reproduce
CodinGame itself suffers from the exact same issue so we don't have plans to fix this on our side either.
The text was updated successfully, but these errors were encountered: