The following code compiles successfully with g++ 8.3 and clang 8.0.0 (compilation flags are -std=c++17 -Wall -Wextra -Werror -pedantic-errors
)
struct Foo
{
};
struct Bar
{
Bar() = default;
Bar(Foo&&)
{
}
};
Bar baz()
{
Foo foo;
return foo;
}
int main()
{
}
Is it a bug in this compilers or a requirement of the C++ standard?