<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><span class="vcard"><a class="email" href="mailto:zhongyunde@tom.com" title="Allen zhong <zhongyunde@tom.com>"> <span class="fn">Allen zhong</span></a>
</span> changed
          <a class="bz_bug_link 
          bz_status_REOPENED "
   title="REOPENED - Missing optimization for member function with const attribute"
   href="https://bugs.llvm.org/show_bug.cgi?id=50735">bug 50735</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>INVALID
           </td>
           <td>---
           </td>
         </tr>

         <tr>
           <td style="text-align:right;">Status</td>
           <td>RESOLVED
           </td>
           <td>REOPENED
           </td>
         </tr></table>
      <p>
        <div>
            <b><a class="bz_bug_link 
          bz_status_REOPENED "
   title="REOPENED - Missing optimization for member function with const attribute"
   href="https://bugs.llvm.org/show_bug.cgi?id=50735#c2">Comment # 2</a>
              on <a class="bz_bug_link 
          bz_status_REOPENED "
   title="REOPENED - Missing optimization for member function with const attribute"
   href="https://bugs.llvm.org/show_bug.cgi?id=50735">bug 50735</a>
              from <span class="vcard"><a class="email" href="mailto:zhongyunde@tom.com" title="Allen zhong <zhongyunde@tom.com>"> <span class="fn">Allen zhong</span></a>
</span></b>
        <pre>thanks for your answer.

how about the following new case.
As member functions const will not change the member variable, so the value 
nPair.bins[0] will not change in function exclusion, then we can assert the
return value must be true?


class NPair /*: protected Pointers */ {
public:
  int bins[10];
  int exclusion(int n) const;
  // int exclusion(int n) __attribute__((const));
};

// extern int * __restrict bins;
extern class NPair nPair;

int foo (void)
{
  int tmp = nPair.bins[0];
  nPair.exclusion(1);

  return tmp == nPair.bins[0];
}</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>