mirror of
https://github.com/vlang/v.git
synced 2025-08-03 17:57:59 -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
|
...node
|
||||||
typ: node.typ.clear_option_and_result()
|
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.empty_line = false
|
||||||
g.write2(s, tmp_var)
|
g.write2(s, tmp_var)
|
||||||
return
|
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