mirror of
https://github.com/vlang/v.git
synced 2025-08-03 09:47:15 -04:00
This commit is contained in:
parent
80128f616e
commit
bf83715b6c
@ -107,7 +107,7 @@ fn (mut g Gen) struct_init(node ast.StructInit) {
|
||||
...node
|
||||
typ: node.typ.clear_option_and_result()
|
||||
})
|
||||
g.writeln('}, &${tmp_var}, sizeof(${base_styp}));')
|
||||
g.writeln('}, (${option_name}*)&${tmp_var}, sizeof(${base_styp}));')
|
||||
g.empty_line = false
|
||||
g.write2(s, tmp_var)
|
||||
return
|
||||
|
16
vlib/v/tests/options/option_struct_default_test.v
Normal file
16
vlib/v/tests/options/option_struct_default_test.v
Normal file
@ -0,0 +1,16 @@
|
||||
struct Element {
|
||||
a int
|
||||
}
|
||||
|
||||
@[noinit]
|
||||
struct RawElement {
|
||||
mut:
|
||||
// tag Tag
|
||||
content []u8
|
||||
default_value ?Element
|
||||
}
|
||||
|
||||
fn test_main() {
|
||||
a := ?RawElement{}
|
||||
dump(a)
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user