title: Compiler error: looser throw specifier for destuctor
body: <pre><code>#include &lt;iostream&gt;    
  
  struct ICantChange
  {
      virtual ~ICantChange() {}
  };
  
  struct ClassThatThrows
  {
      virtual ~ClassThatThrows() noexcept(false)
      {
          throw 44;
      }
  };    
  
  struct Test : ICantChange
  {
      ~Test() 
      {
      }    
      ClassThatThrows instance;
  };
  
  main()
  {
      try 
      {
          Test obj;
      }
      catch(int except)
      {
          std::cout &lt;&lt; "caught" &lt;&lt; std::endl;
      }
  }
  </code></pre>
  
  <p>This code gives error message:</p>
  
  <pre><code>main.cpp:20:5: error: looser throw specifier for ‘virtual Test::~Test() noexcept (false)’
       ~Test()
       ^
  main.cpp:6:13: error:   overriding ‘virtual ICantChange::~ICantChange() noexcept’
       virtual ~ICantChange() {}
  </code></pre>
  
  <p>To fix that error the only option I see is to add <code>noexcept(false)</code> to the destructor of class <code>ICantChange</code> that I cant because it is a library class.</p>
  
  <p>I know that throwing destructors are bad but now I have <code>Test</code> class and I want to catch exceptions that are thrown when it is destructed.</p>
  
  <p>Can anyone suggest a solution?</p>