mirror of
https://github.com/vlang/v.git
synced 2025-09-14 23:12:33 +03:00
cgen: fix alloc empty struct array error (#14007)
This commit is contained in:
parent
843ce43077
commit
25d8faabf6
4 changed files with 32 additions and 3 deletions
|
@ -300,3 +300,15 @@ fn test_alias_string_contains() {
|
|||
names := [Str('')]
|
||||
assert (Str('') in names) == true
|
||||
}
|
||||
|
||||
struct XYZ {}
|
||||
|
||||
fn test_array_append_empty_struct() {
|
||||
mut names := []XYZ{cap: 2}
|
||||
names << XYZ{}
|
||||
assert (XYZ{} in names) == true
|
||||
|
||||
// test fixed array
|
||||
array := [XYZ{}]
|
||||
assert (XYZ{} in names) == true
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue