What's the requirements on the following case in the current C++ Standard?
Suppose that we have the following code:
#include <iostream>
struct Foo
{
Foo() { std::cout << "Foo::Foo()" << std::endl; }
Foo(Foo&) { std::cout << "Foo::Foo(Foo&)" << std::endl; }
Foo(Foo&&) { std::cout << "Foo::Foo(Foo&&)" << std::endl; }
~Foo() { std::cout << "Foo::~Foo()" << std::endl; }
};
struct Bar
{
Foo foo;
};
int main()
{
Bar instance{ Foo{} };
}
What should any implementation do here according to the Standard? Does it require both copy and move constructor to exist (not to be deleted)? Which one should it call?