title: Why does temporary struct member not have the expected value in C++?
body: <p>Consider this code:</p>
  <pre><code>#include&lt;iostream&gt;
  
  struct A
  {
      int b;
  };
  
  int main()
  {
      int c = (A() = A{2}).b;  // Why is c zero after this?
      std::cout &lt;&lt; &quot;c = &quot; &lt;&lt; c &lt;&lt; std::endl;
      std::cout &lt;&lt; &quot;A.b = &quot; &lt;&lt; (A() = A{2}).b &lt;&lt; std::endl;
  }
  </code></pre>
  <p>In my mind this is two equivalent ways to print the same value, but I get this result (on GCC 7.3.0 under MinGW):</p>
  <pre><code>c = 0
  A.b = 2
  </code></pre>
  <p>I would have expected <code>c</code> to be 2. Can anyone explain why it is 0?</p>