Skip to content

Commit b052af8

Browse files
authored
cgen: use variadic_count == 1 when passing variadic to call of same array type (fix #25827) (#25837)
1 parent 8938a40 commit b052af8

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

vlib/v/gen/c/fn.v

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2612,7 +2612,7 @@ fn (mut g Gen) call_args(node ast.CallExpr) {
26122612
}
26132613
} else {
26142614
// passing variadic arg to another call which expects same array type
2615-
if args.len == 1
2615+
if variadic_count == 1
26162616
&& ((args[arg_nr].typ.has_flag(.variadic) && args[arg_nr].typ == varg_type)
26172617
|| (varg_type.has_flag(.variadic)
26182618
&& args[arg_nr].typ == varg_type.clear_flag(.variadic))) {
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
fn called(s string, l ...string) {}
2+
3+
fn caller(s string, l ...string) {
4+
called(s, l)
5+
}
6+
7+
fn test_main() {
8+
caller('')
9+
}

0 commit comments

Comments
 (0)