Skip to content
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

using a C struct as a struct field does not adopted default values #21501

Closed
ttytm opened this issue May 14, 2024 · 1 comment · Fixed by #21510
Closed

using a C struct as a struct field does not adopted default values #21501

ttytm opened this issue May 14, 2024 · 1 comment · Fixed by #21510
Assignees
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

@ttytm
Copy link
Member

ttytm commented May 14, 2024

Describe the bug

// header.h
typedef struct Bar {
  int a;
} Bar;
#include "@VMODROOT/header.h"

struct Foo {
	a int = 3
}

struct C.Bar {
	a int = 3
}

struct FooBar {
	foo Foo
	bar C.Bar
}

dump(Foo{}) // has default value

dump(C.Bar{}) // has default value

dump(FooBar{}) // Foo has default value while C.Bar does not

Reproduction Steps

above

Expected Behavior

default values work for the C struct also when it is used as a field of another struct.

Current Behavior

no default values when the C struct is used as a struct field.

Possible Solution

No response

Additional Information/Context

No response

V version

V 0.4.5 58a8fc6

Environment details (OS name and version, etc.)

all

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.

@ttytm ttytm added the Bug This tag is applied to issues which reports bugs. label May 14, 2024
@felipensp
Copy link
Member

Good catch. 👍🏻

@felipensp felipensp added the Unit: cgen Bugs/feature requests, that are related to the default C generating backend. label May 14, 2024
@felipensp felipensp self-assigned this May 15, 2024
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.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants