Why is forwarding variadic parameters invalid?

Posted by awesomeyi on Stack Overflow See other posts from Stack Overflow or by awesomeyi
Published on 2014-06-04T21:15:21Z Indexed on 2014/06/04 21:24 UTC
Read the original article Hit count: 178

Consider the variadic function parameter:

func foo(bar:Int...) -> () { }

Here foo can accept multiple arguments, eg foo(5,4). I am curious about the type of Int... and its supported operations. For example, why is this invalid?

func foo2(bar2:Int...) -> () {
    foo(bar2);
}

Gives a error:

Could not find an overload for '_conversion' that accepts the supplied arguments

Why is forwarding variadic parameters invalid?

What is the "conversion" the compiler is complaining about?

© Stack Overflow or respective owner

Related posts about swift-language

Related posts about variadic-functions