title: Destruction order of class data members?
body: <p>Imagine a class like this:</p>
  
  <pre><code>class foo {
  public:
      foo() : _bar{new bar}, _baz{new baz} {}
  private:
      unique_ptr&lt;bar&gt; _bar;
      unique_ptr&lt;baz&gt; _baz;
  };
  </code></pre>
  
  <p>So whenever an instance of <code>foo</code> gets destructed, then in what order will the data members of it be destroyed, if that's defined behavior at all?</p>
  
  <p>Let's say that <code>_baz</code> does depend on the existance of <code>_bar</code>, maybe it uses some resource that <code>_bar</code> owns (let's assume it knows about the <code>_bar</code> object, even though the constructor doesn't reflect this).
  So in this case, if <code>_bar</code> gets destructed first (when its time to destruct <code>foo</code>), then <code>_baz</code> could potentially try to access some resource which has been freed by <code>_bar</code>'s destructor.</p>
  
  <p>An obvious solution is to implement a destructor in <code>foo</code>, which manually frees <code>_baz</code> and <code>_bar</code> in the right order, but what if there's no destructor implemented? Is there a default behavior that defines the destruction order of data members?</p>