We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Please provide any relevant information about your setup. This is important in case the issue is not reproducible except for under certain conditions.
related to the resolved: #3964
Expecting a bus error like when trying to modify a readonly array in a struct
What is the current behavior? the slice is modified successfully
MyStruct :: struct { nums : []int, arr_nums : [3]int} @(rodata) my_struct : MyStruct = MyStruct{nums = []int {1,2,3}, arr_nums = [3]int {4,5,6}} ret_m_slice :: proc() -> MyStruct { return my_struct; } main :: proc() { x := ret_m_slice(); fmt.println(x); fmt.println("modify slice local"); x.nums[1] = 11; fmt.println(ret_m_slice()); fmt.println("modify slice direct"); my_struct.nums[1] = 99; fmt.println(ret_m_slice()); //throws error fmt.println("modify arr"); my_struct.arr_nums[1] = 22; fmt.println(ret_m_slice()); }
odin build temp && ./temp.bin MyStruct{nums = [1, 2, 3], arr_nums = [4, 5, 6]} modify slice local MyStruct{nums = [1, 11, 3], arr_nums = [4, 5, 6]} modify slice direct MyStruct{nums = [1, 99, 3], arr_nums = [4, 5, 6]} modify arr zsh: bus error ./temp.bin
The text was updated successfully, but these errors were encountered:
Fixed by b0fe777
Sorry, something went wrong.
No branches or pull requests
Context
Please provide any relevant information about your setup. This is important in case the issue is not reproducible except for under certain conditions.
related to the resolved: #3964
macos sonoma | dev-2024-07:bc5b41938
Expected Behavior
Expecting a bus error like when trying to modify a readonly array in a struct
Current Behavior
What is the current behavior? the slice is modified successfully
Steps to Reproduce
Failure Logs
The text was updated successfully, but these errors were encountered: