title: C++ Address of Temporary Doesn't Cause a Build Error
body: <p>One of my coworkers recently produced code similar to the following in VS2008:</p>
  
  <pre><code>class SomeClass {
      ...
  };
  
  void foo(SomeClass const *f) {
      ...
  }
  
  SomeClass bar() {
      ...
  }
  
  foo(&amp;bar());
  </code></pre>
  
  <p>My interpretation was that this is incorrect code, since the address of the temporary returned by <code>bar</code> was being passed into <code>foo</code>.  However, if <code>bar</code> really returns an rvalue, this should produce a compile-time error.  Can someone please point me to the relevant parts of the C++ standard that specifies whether this code results in well-defined or undefined behavior?</p>