<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><span class="vcard"><a class="email" href="mailto:aaron@aaronballman.com" title="Aaron Ballman <aaron@aaronballman.com>"> <span class="fn">Aaron Ballman</span></a>
</span> changed
          <a class="bz_bug_link 
          bz_status_RESOLVED  bz_closed"
   title="RESOLVED FIXED - Produce warning when a derived class shadows a field of the base class with `-Wshadow`"
   href="https://bugs.llvm.org/show_bug.cgi?id=31222">bug 31222</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;">Status</td>
           <td>NEW
           </td>
           <td>RESOLVED
           </td>
         </tr>

         <tr>
           <td style="text-align:right;">Resolution</td>
           <td>---
           </td>
           <td>FIXED
           </td>
         </tr></table>
      <p>
        <div>
            <b><a class="bz_bug_link 
          bz_status_RESOLVED  bz_closed"
   title="RESOLVED FIXED - Produce warning when a derived class shadows a field of the base class with `-Wshadow`"
   href="https://bugs.llvm.org/show_bug.cgi?id=31222#c1">Comment # 1</a>
              on <a class="bz_bug_link 
          bz_status_RESOLVED  bz_closed"
   title="RESOLVED FIXED - Produce warning when a derived class shadows a field of the base class with `-Wshadow`"
   href="https://bugs.llvm.org/show_bug.cgi?id=31222">bug 31222</a>
              from <span class="vcard"><a class="email" href="mailto:aaron@aaronballman.com" title="Aaron Ballman <aaron@aaronballman.com>"> <span class="fn">Aaron Ballman</span></a>
</span></b>
        <pre>Clang currently supports -Wshadow-field to catch exactly this situation. It's
not enabled by -Wshadow because this diagnostic has a fair number of "false"
positives that users aren't always interested in dealing with. Consider this
case:

struct S {
  int x, y;
};

struct D : S {
  int z;

  int f() {
    return z;
  }
};

Everything is great -- there's no shadowing. Sometime later, a developer goes
and changes the definition of S to:

struct S {
  int x, y, z;
};

This creates a shadow within D, but it didn't actually break anything either.</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>