Ignoring the copy/move elision from the compiler, I would like to know if the following code (assuming foo has a constructor accepting three ints) "syntactically" creates a temporary object and then copy/move initializes the function argument, or directly calls the constructor:
void acceptsFoo(foo a);
acceptsFoo({1, 2, 3});
And what about this case?
//ignoring RVO optimization
foo returnsFoo()
{
return {1, 2, 3};
}
I know that the code below, even without copy/move elision, is the same as calling the constructor so will not generate any temporary, but I couldn't find info about the code above.
foo = { 1, 2, 3 } //assuming the constructor is non-explicit
foo { 1, 2, 3 }