Skip to content

Default values for structs don't nest #122

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

Closed
brokenbeta opened this issue Oct 14, 2017 · 0 comments
Closed

Default values for structs don't nest #122

brokenbeta opened this issue Oct 14, 2017 · 0 comments

Comments

@brokenbeta
Copy link

I think this should be a simple one:

import "core:fmt.odin"

Inner :: struct
{
	thing: int = 5
}

Outer :: struct
{
	inner: Inner
}

main :: proc()
{
	fmt.println(Inner {}); // Inner{thing = 5}
	fmt.println(Outer {}); // Outer{inner = Inner{thing = 0}}
}

I would expect that the thing member of outer would contain the 5 by default.

gingerBill added a commit that referenced this issue Oct 15, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants