Q:

std::vector without exceptions: warning C4530: C++ exception handler used, but unwind semantics are not enabled. Specify /EHsc

I am trying to insert a moveable, non-copyable object into std::vector. I reduced the original code to this example:
#include <vector>
class MovingClass
{
public:
  MovingClass(const int value) : _value(new int(value)) {}
  //! No copy allowed
  MovingClass(const MovingClass& src) = delete;
  MovingClass& operator=(const MovingClass& src) = delete;
  // move is OK
  MovingClass(MovingClass&& source) : _value(source._value) { source._value = nullptr; }
  MovingClass& operator=(MovingClass&& source) { _value = source._value; source._value = nullptr; }

  ~MovingClass() { delete _value; }
  // do not mind that this is all kinds of bad, it's just an example
  int* _value;
};

int test_vector_main()
{
  std::vector<MovingClass> containers;
  containers.push_back({ 42 });

  return 0;
}

The original purpose of the class is closing winapi handles, not deleting pointers.
I can reproduce the warning in a blank project if I set "Enable C++ Exceptions" to "No" in Configuration Properties->C/C++->All Options.
The project I work with treats warnings as errors and has exceptions disabled.
I am not sure what to do except giving up on no-copy rules or enabling the exceptions. I'll enable the exceptions, but if I couldn't what else could I do?
Why does push_back even require exceptions?

A:

Why does push_back even require exceptions?

vector::push_back has to do two things:

Make sure that there's space for the new element. That could involve allocating memory - which can fail. It reports this failure by throwing an exception.
Construct a new element in the vector. That involves calling your class' copy or move constructor - which can fail. Constructors usually report failures by throwing an exception.

You can indicate that your move constructor will never fail by marking it as noexcept.

