I have this simple piece of code in C++17 and I was expecting that the move constructor was called (or the copy constructor, if I was doing something wrong), while it is just calling the normal constructor and I cannot why is doing this optimization.
I am compiling with -O0 option.
#include <iostream>
using namespace std;
struct Foo {
  int m_x;
  Foo(int x) : m_x(x) { cout << "Ctor" << endl; }
  Foo(const Foo &other) : m_x(other.m_x) { cout << "Copy ctor" << endl; }
  Foo(Foo &&other) : m_x(other.m_x) {
    other.m_x = 0;
    cout << "Move ctor" << endl;
  }
};
void drop(Foo &&foo) {}
int main() { drop(Foo(5)); }