-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New IS engine is unable to recognize C99 for loop initial declaration #685
Comments
I'm not able to repro the problem you describe (I don't get those error squiggles in a .c file). We have some bugs in regards to error squiggles not being updated correctly after a file is edited. Could you be hitting that? What OS are you on? |
The issue is reproduced by creating new file named test.c and typing in the following content: int main()
{
for (int i = 0; i < 10; ++i) {}
} Saving/editing issues definitely aren't involved here. I'm seeing this on both macOS (latest VSCode Insider 0.12.0, 0834f15...) and GNU/Linux (VSCode 1.11.2, 6eaebe3...). |
To elaborate on that "definitely" part, I tried closing and re-opening the file, and restarting VSCode. All the same. I also had all the extensions except for ms-vscode.cpptools disabled. |
Okay, thanks a lot for this report. It's a bug with our Linux/Mac implementation and doesn't repro on Windows. |
We have a fix for our next update, but you can make the change yourself by opening ~/.vscode/extensions/ms-vscode.cpptools-0.11.0/bin/msvc.json file and replacing "--c" with "--c\n--c11" near the bottom of the file. Let us know if you encounter any issue with this. |
Thanks, the workaround worked a treat. |
This was fixed in version 0.11.1. Please reopen if you continue to have this issue. |
I'm using v0.11.0 with Default IS mode and Enabled error squiggles, and editing C file (with .c extension). This seems to work fine (pre-C99):
Moving variable declaration into the for construct like this (C99):
leads to error squiggles saying "expected an expression" and "identifier "i" is undefined". Changing "int" in the above example to a typedef-ed type leads to a bit different set of errors: "type name is not allowed", "expected a ';'", and "identifier "i" is undefined".
This is confusing as some other C99 features like intermixing code and variable declarations are being processed just fine. And even more confusing as you advertise this new IS engine as being based on MSVC IS engine and VS 2015 has no trouble recognizing the above construct as well.
The text was updated successfully, but these errors were encountered: