Suppose you have a functions like this:
Foo foo() {
Foo foo;
// more lines of code
return foo; // is the copy constructor called here?
}
Foo bar() {
// more lines of code
return Foo(); // is the copy constructor called here?
}
int main() {
Foo a = foo();
Foo b = bar();
}
When any of the functions return, is the copy constructor called (suppose there would be one)?