-
-
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
C compilation error in nested array declaration #23818
Labels
Bug
This tag is applied to issues which reports bugs.
Status: Confirmed
This bug has been confirmed to be valid by a contributor.
Unit: cgen
Bugs/feature requests, that are related to the default C generating backend.
Comments
Connected to Huly®: V_0.6-22226 |
If I understood your idea, I think here is a workaround fn main() {
for r in works() {
println(r)
}
//for r in fails() {
// println(r)
//}
}
fn works() [][][]int {
return [][][]int{ len: 10, init: if index == 0 || index == 9 {
[][]int{ len:10, init:[1] }
} else {
[ []int{ len:1, init:1 }, []int{}, []int{}, []int{}, []int{}, []int{}, []int{}, []int{}, []int{}, []int{ len:1, init:1 } ]
}
}
}
fn fails() [][][]int {
return [][][]int{ len: 10, init: if index == 0 || index == 9 {
[][]int{ len: 10, init:[1] }
} else{
[][]int{ len: 10, init: if index == 0 || index == 9 {
[1]
} else {
[]
}
}
}
}
} produces:
If I uncomment your code I set in function
I wonder if special variable |
With
|
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.
Status: Confirmed
This bug has been confirmed to be valid by a contributor.
Unit: cgen
Bugs/feature requests, that are related to the default C generating backend.
Describe the bug
C compilation error
Reproduction Steps
Expected Behavior
Suppose to create triple nest array [][][] using nested conditions
Current Behavior
C compilation error
Possible Solution
No response
Additional Information/Context
No response
V version
V 0.4.9 81fd0db.a1f7213
Environment details (OS name and version, etc.)
windows, Microsoft Windows 10 Pro 19045 64-bit
Note
You can use the 👍 reaction to increase the issue's priority for developers.
Please note that only the 👍 reaction to the issue itself counts as a vote.
Other reactions and those to comments will not be taken into account.
The text was updated successfully, but these errors were encountered: