Can vector types be returned from functions?

I was wondering if someone could verify if variables of vector types can be returned from non-kernel functions. In other words, as an example, is the following OpenCL code legal:

int2 foo(int i) {
int2 tmp = (int2)(i);
return tmp;
}

Thank you.

Adam

I have a somewhat related question to my previous one. When vectors are passed as arguments to functions, are they being passed (as if) by value? In other words, is it expected that value of v can change after a call to foo()?

int2 v;
foo(v);

Thank you.

Adam

Vectors passed as arguments to functions are passed by value. And vector types can be returned from non-kernel functions. The example you gave where function foo returns an int2 value is allowed.