title: Warning: definition of implicit copy constructor is deprecated
body: <p>I have a warning in my C++11 code that I would like to fix correctly but I don't really know how. I have created my own exception class that is derived from <code>std::runtime_error</code>:</p>
  
  <pre><code>class MyError : public std::runtime_error
  {
  public:
      MyError(const std::string&amp; str, const std::string&amp; message)
        : std::runtime_error(message),
          str_(str)
      { }
  
      virtual ~MyError()
      { }
  
      std::string getStr() const
      {
          return str_;
      }
  
    private:
        std::string str_;
  };
  </code></pre>
  
  <p>When I compile that code with clang-cl using <code>/Wall</code> I get the following warning:</p>
  
  <pre><code>warning: definition of implicit copy constructor for 'MyError' is deprecated 
           because it has a user-declared destructor [-Wdeprecated]
  </code></pre>
  
  <p>So because I have defined a destructor in <code>MyError</code> no copy constructor will be generated for <code>MyError</code>. I don't fully understand if this will cause any issues...</p>
  
  <p>Now I could get rid of that warning by simply removing the virtual destructor but I always thought that derived classes should have virtual destructors if the base class (in this case <code>std::runtime_error</code>) has a virtual destructor.</p>
  
  <p>Hence I guess it is better not to remove the virtual destructor but to define the copy constructor. But if I need to define the copy constructor maybe I should also define the copy assignment operator and the move constructor and the move assignment operator. But this seems overkill for my simple exception class!?</p>
  
  <p>Any ideas how to best fix this issue?</p>