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

    <tr>
        <th>Summary</th>
        <td>
            [clang-tidy] bugprone-crtp-constructor-accessibility for deleted constructor
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            clang-tidy
      </td>
    </tr>

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

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

<pre>
    In this basic example of CRTP pattern:

```c++
template<typename D>
class base
{
  friend D;

  base() = default;
  base(const base&) = default;

  base(base&&) = delete;
};

class derived : public base<derived>
{
};
```

I get the following warning, which is expected and reasonable:
```
project_root/test.cpp:9:3: warning: deleted member function should be public [hicpp-use-equals-delete,modernize-use-equals-delete]
    9 |   base(base&&) = delete;
      |   ^
```

while on the other hand, if I were to move the constructor to the public area: 

```c++
template<typename D>
class base
{
  friend D;

  base() = default;
  base(const base&) = default;

public:
  base(base&&) = delete;
};

class derived : public base<derived>
{
};
```

the following warning is not needed since the constructor has been deleted:

```
project_root/testcpp:10:3: warning: public contructor allows the CRTP to be constructed as a regular template class; consider making it private [bugprone-crtp-constructor-accessibility]
 10 |   base(base&&) = delete;

```
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJzUVU2v4yYU_TV4c-UIg528LLzIx0R6u6rqvsJwbTPF4AJO5vXXV9hOXqSXxXRVjYVkGc79OIdjECHoziLWpDqS6pyJKfbO12c96Oj1dzy7xrsossapj_rdQux1gEYELQF_iGE0CK6F0-9__AajiBG9JfxA6Dy2dBmSsGMa9BBxGI2ISPgpfoxoxYBwJvwboQdpRJgzYwrdJTRA6zValSDHJScsCPZG2B4IP4PCVkwmLoDHqnQ2xPVj-xL6jH7gnqAGU5czcvdZfmlSoddXVED4AcapMVoumfhpXVkYLSQ-w-9yLKneocMIsUdonTHupm0HN-Gtth1hJ7j1WvagA-CPEWVEBcIq8CiCs6IxuKr8lHP07jvK-Kd3LhJ2iRjiRo4j4Yc94Qeemr3n54eVoYIBhwY9tJOVUTsLoXeTUdDgnRmpjr2W45hPAXP8exIm5Ks87DQ4hd7qf_DFanWeNQbYA9md4CfVhvlZAkj17atut14nz9lZOhd79NALq5JmuoV3uKFHiA4Gd8UZM3vBTzI6n-bT1EpNeBRJi1_DrkvTy77_v9Z9adrkVesiWESFCoK28qv-vQjQINq7_b6eFa-NvPi4oC-MvLKQzt6LiNRZmGvP51J0yc6PNtKvFECAx24ywsN9k2FWiPDjDNUKPQzir5lZhNHra8KQ6thM3eidxVz6OOZP7HIhJYagG210_Fj9X9D_4v5nJTJVc7Xne5FhXezKihZlWe6zvt6W1VspOa0kQ_UmS7qlnKq22O4KiSVtM10zyipaFm-MFSXdb7DYKrlrSlEKRVuUpKQ4CG02xlyHjfNdpkOYsC74lu92mRENmjDfCIxJI2yXR60-CGPphvB1isqbqQukpEaHGD7zRB3NfJc8hVVn-EnNoHX-cTI9obLJm7qPcQzJMOxC2KXTsZ-ajXQDYZdUfn3lq3sIu8ycAmGXlda1Zv8GAAD__7W6JN0">