-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
CGen: undeclared variable #19584
Labels
Bug
This tag is applied to issues which reports bugs.
Unit: cgen
Bugs/feature requests, that are related to the default C generating backend.
Comments
ArtemkaKun
added
Unit: cgen
Bugs/feature requests, that are related to the default C generating backend.
Build
V build error on any OS/CPU architecture.
labels
Oct 17, 2023
This appears to be a bug with how If statement chains are resolved. It's adding an extra }. |
Can you try again with the newer V version? |
@felipensp Yes, unfortunately. |
Maybe it's related to this:
|
@shove70 |
Possible workaround: ret_type := match p.current()!.tag {
.ident {
?usize(p.consume_ident()!)
}
.l_bracket { // Compiler error
return error('Expected type name as return type')
}
else {
?usize(none)
}
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Bug
This tag is applied to issues which reports bugs.
Unit: cgen
Bugs/feature requests, that are related to the default C generating backend.
Describe the bug
For an unknown reason, a defined local variable is marked as undefined by the c compiler.
Reproduction Steps
Unknown minimum reproduction. Running
v run src
on the project should cause the error, as it does so on windows and linux. The error seems around here.Expected Behavior
The program compiles.
Current Behavior
Possible Solution
No response
Additional Information/Context
The error appears here, I believe. the generated c code is as follows:
This is unexpected, as _t19 is declared above.
V version
V 0.4.2 25777bd
Environment details (OS name and version, etc.)
Ubuntu, Windows 11.
Note
You can vote for this issue using the 👍 reaction. More votes increase the issue's priority for developers.
Take into account that only the 👍 reaction counts as a vote.
Only reactions to the issue itself will be counted as votes, not comments.
The text was updated successfully, but these errors were encountered: