<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/111985>111985</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            cppcoreguidelines-avoid-const-or-ref-data-members gives false positive when a templated class inherits
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          Osse
      </td>
    </tr>
</table>

<pre>
    When a class with a const ref member inherits a class that deletes move/copy constructors and assignment operators `cppcoreguidelines-avoid-const-or-ref-data-members` still points out the ref member. This is not an unusual technique (e.g. inheriting from `boost::noncopyable`). I have written a test case on [Compiler Explorer](https://godbolt.org/z/fxxPMdsh8) that you can tweak using the `#define`s.

If the derived class is _not_ a template the check works as expected. If the class _is_ a template but deletes deletes the move/copy constructors and assignment operators itself also works as expected.

Summary:
|Is template|Inherits|False positive|
|--------------|-----------|--------------------|
|Yes|Yes|**Yes**|
|Yes|No|No|
|No|Yes|No|

Also, if the derived class is a template and inherits _and deletes the constructors/operators anyway_ it works as expected. But  this is presumably a "sub-case" of the non-inheriting case.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyUVMtu6zYQ_Rp6M5AgUZZjL7RwkhrIog-gBYquDEoaWWwoUuUM7bhfX1ByFKf33kW0oEjOA2fO4Ywi0ieLWInyUZTPKxW4d776lQhXtWuv1Z89WlDQGEUEF819PDhLDB47GHCo0YO2PXrNtDhyrxhaNMhIMLgzCnlo3HidQ31o2HkCZVuYAQxoGdyIXk0GscmacWycx1PQLRptkRJ1drpNpgSJ84nHLmkVq2TGQGKTAbE2BkanLRO4wMA93uFM4Y9eE2gC6xiUhWADBWWAsemt_icgCLnF9JS-V6TtCTrvhoiodo5YFHtR7K2zsRpVGxSbTMhdCi_QqzPCxWvmiTFGYmgUITgLonx8csOoDXr46W00zqMX5bOQ2555pJhVHoQ8nFxbO8Op8ychD_8Keeje3n77uaV-K-RupvXqAjTKAl9QvUKgiDHWOSEpWuy0jagoFdmzyPbz-tJNPi16fcb2ppImOFrHxwntMBrFOHk1PTavcHH-lUAR4NuIDWObwi3LHH3U9CmyDh-Sv_-j99fl10xoOlCG3HdQ3Jf1exgG5a-Rv_n24emFFkjxdHuZ4uHpoAwhjI4063O0LSHJp-_zxTfm5XoJ_wtpWYXcC7mP-2nzrdsv7n1ZDNPpznpf4N6QE_IJ9A_0u-M_0rk04jGe7lW4Z17IwwfZyl4v6noEzd9T_DEwAN-6ZvRIYVC1uYICISWFOokvXEgJbgZonU3ueida01VbFe2u2KkVVvmD3G7Wm3W-WfUVdtlOdfW6WKPclUpum11Ro8zbboNFmW9XupKZXOdZnud5URRl2hVZXRcye2hkmeOmFOsMB6VNasx5iF2z0kQBqzzPd9tyZVSNhqbZJqXFC0xWIWUcdb6KQUkdTiTWmdHE9JGGNRusvjyE4KTPSNB9empw6W8TYVZqke8m1ip4U_1vDmjuQ502bhDyEEHdfsno3d_YsJCHqZQo5a3WcyX_CwAA__-_2-zE">