title: Taking the address of a temporary object
body: <p>§5.3.1 Unary operators, Section 3</p>
  
  <blockquote>
    <p>The result of the unary &amp; operator is a pointer to its operand. <strong>The operand shall be an lvalue</strong> or a qualified-id.</p>
  </blockquote>
  
  <p>What exactly does "shall be" mean in this context? Does it mean it's an error to take the address of a temporary? I was just wondering, because g++ only gives me a warning, whereas comeau refuses to compile the following program:</p>
  
  <pre><code>#include &lt;string&gt;
  
  int main()
  {
      &amp;std::string("test");
  }
  </code></pre>
  
  <p>g++ <strong>warning</strong>: <code>taking address of temporary</code></p>
  
  <p>comeau <strong>error</strong>: <code>expression must be an lvalue or a function designator</code></p>
  
  <p>Does anyone have a Microsoft compiler or other compilers and can test this program, please?</p>