title: Throw temporary instead of local variable - why?
body: <p>The code in question is this:</p>
  
  <pre><code>struct something_bad_happened_exception : std::exception {};
  
  void foo() {
      something_bad_happened_exception e;
      throw e;
  }
  </code></pre>
  
  <p>clang gives a warning that reads:</p>
  
  <blockquote>
    <p>Throw expression should throw anonymous temporary values instead
    [cert-err09-cpp]</p>
  </blockquote>
  
  <p>which means <code>foo()</code> should be changed to:</p>
  
  <pre><code>void foo() {
      throw something_bad_happened_exception();
  }
  </code></pre>
  
  <p>Why is it better to throw a temporary instead of a local variable?</p>