title: C++ catching dangling reference
body: <p>Suppose the following piece of code</p>
  
  <pre><code>struct S {
      S(int &amp; value): value_(value) {}
      int &amp; value_;
  };
  
  S function() {
      int value = 0;
      return S(value);   // implicitly returning reference to local value
  }
  </code></pre>
  
  <p>compiler does not produce warning (-Wall), this error can be hard to catch.</p>
  
  <p>What tools are out there to help catch such problems</p>