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

    <tr>
        <th>Summary</th>
        <td>
            [clang-tidy] Using an aliased name of a class for its copy/move/assignment constructors/operators produces a false positive `cppcoreguidelines-special-member-functions` warning.
        </td>
    </tr>

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

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

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

<pre>
    The following class produces a false positive Wcppcoreguidelines-special-member-functions with LLVM 19.1.3:

```cxx
template <typename T, unsigned ROWS, unsigned COLS> requires (ROWS >= 2 && COLS >= 2)
class Mat {
public:
        static constexpr size_t mat_rows = ROWS;
        static constexpr size_t mat_cols = COLS;

        using scalar_type = T;
        using mat_type = Mat<scalar_type, mat_rows, mat_cols>;

protected:
        using array_type = std::array<scalar_type, mat_rows* mat_cols>;

private:
        array_type m_elements = { };

public:
        constexpr Mat() noexcept = default;

        constexpr Mat(const mat_type& _other) noexcept {
                std::ranges::copy(_other.m_elements, std::begin(m_elements));
        }

        constexpr Mat(mat_type&& _other) noexcept :
                m_elements{ std::move(_other.m_elements) } {
        }

        virtual ~Mat() noexcept = default;

        constexpr auto& operator=(const mat_type& _other) noexcept {
                std::ranges::copy(_other.m_elements, std::begin(m_elements));
                return *this;
        }

        constexpr auto& operator=(mat_type&& _other) noexcept {
                m_elements = std::move(_other.m_elements);
                return *this;
        }
};
```

This happens due to the alias `using mat_type = Mat<scalar_type, mat_rows, mat_cols>;`. If I replace the alias `mat_type` in the constructors and assignment operators with the full class name, the warning goes away.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzMVk9vozgU_zTO5SkRmISEA4emmUgjTTXSTnfnWBnzAK8MZu3ntNnDfvaVIU1IO1NFoz2shAIx78_vD-YhnFN1h5iz1ZatdjPhqTE2l9a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