<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><span class="vcard"><a class="email" href="mailto:dimitry@andric.com" title="Dimitry Andric <dimitry@andric.com>"> <span class="fn">Dimitry Andric</span></a>
</span> changed
          <a class="bz_bug_link 
          bz_status_RESOLVED  bz_closed"
   title="RESOLVED INVALID - BackendUtil's EmitAssemblyHelper::EmitAssembly generated call in wrong order"
   href="https://bugs.llvm.org/show_bug.cgi?id=35737">bug 35737</a>
          <br>
             <table border="1" cellspacing="0" cellpadding="8">
          <tr>
            <th>What</th>
            <th>Removed</th>
            <th>Added</th>
          </tr>

         <tr>
           <td style="text-align:right;">Resolution</td>
           <td>---
           </td>
           <td>INVALID
           </td>
         </tr>

         <tr>
           <td style="text-align:right;">Status</td>
           <td>NEW
           </td>
           <td>RESOLVED
           </td>
         </tr>

         <tr>
           <td style="text-align:right;">CC</td>
           <td>
                
           </td>
           <td>dimitry@andric.com
           </td>
         </tr></table>
      <p>
        <div>
            <b><a class="bz_bug_link 
          bz_status_RESOLVED  bz_closed"
   title="RESOLVED INVALID - BackendUtil's EmitAssemblyHelper::EmitAssembly generated call in wrong order"
   href="https://bugs.llvm.org/show_bug.cgi?id=35737#c4">Comment # 4</a>
              on <a class="bz_bug_link 
          bz_status_RESOLVED  bz_closed"
   title="RESOLVED INVALID - BackendUtil's EmitAssemblyHelper::EmitAssembly generated call in wrong order"
   href="https://bugs.llvm.org/show_bug.cgi?id=35737">bug 35737</a>
              from <span class="vcard"><a class="email" href="mailto:dimitry@andric.com" title="Dimitry Andric <dimitry@andric.com>"> <span class="fn">Dimitry Andric</span></a>
</span></b>
        <pre>Try seeing your program as follows (which is what actually happens):

#include <iostream>

int bar() {
  std::ostream& os1 = std::cout.operator<<("bar");
  std::ostream& os2 = os1.operator<<(std::endl);
  return 1;
}

int main() {
  std::ostream& os1 = std::cout.operator<<("return: ");
  std::ostream& os2 = os1.operator<<(bar());
  std::ostream& os3 = os2.operator<<(std::endl);
  return 0;
}

then you'll understand why the output first shows "return: ", then the result
of bar().

Note that in my testing, both clang and gcc give exactly the same output.  If
your version of gcc prints something different, then that is either a bug in
your gcc, or in libstdc++.</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>