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

    <tr>
        <th>Summary</th>
        <td>
            [clang-tidy] False positive `cppcoreguidelines-pro-type-static-cast-downcast` when base type is not polymorphic
        </td>
    </tr>

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

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

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

<pre>
    https://godbolt.org/z/ddE4bYnse

```cpp
struct Base
{
    int i;
};

struct Derived : Base
{
    float f;
};

int main()
{
    Derived d1;
    Base& base = d1;
    Derived& d2 = static_cast<Derived&>(base);
}
```

`cppcoreguidelines-pro-type-static-cast-downcast` emits a warning even when the base class is not polymorphic. In the above case the `static_cast` is necessary to cast from base to derived since a `dynamic_cast` is not allowed.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJycU82OmzAQfhpzGREZGwgcOGw2i9R7Lz1Vxp6AK2Mj2ySiT18B2b9o20MlBMbz_XhmPCIE3VvEhhQnUpwTMcfB-eZ58Dp8H7wIA_qkc2pphhinQPgTYS1hbe9U50w8ON8T1v4mrFXqJe9-2ICEngl9ur9Luj9ymvadEP0sI5zEG_B42hcAANpG0ISfXkPn9_VH9hm9vqICwp_-pnQxTkS4_ENr9RqFtoRVhNVfSLy6qOyNuW5vhqyETgQEws-P8TtthSi2AUIUUcufUoRI-PN7nPAXwqpu06s_nfRz8R4qKqdJOo_9rBUabTGkk3dpXCZMd6d0dUqVu9nNsqSAo44BBNyEt9r2gFe0cBvQQhxwz0QaEQLoANZFmJxZRuenQcsDfNtRonNXBLli119S0o95lXTjosQQhF8guhUa4eLduBtEB-pe0aCtRBCrhlqsGB9EXARhjLuhOiSq4armtUiwycr6WFLK8zIZmlzmvKYqL4tLeSxqeWFVXhwv3bGieYV1luiGUcYzmlWU85oWByq56nKeY5EVGa0kySmOQpuDMddxvciJDmHGpqzzLE-M6NCEbSwYk0bYPo1aLYSxdUx8s5LSbu4DyanRIYZ3maij2QbqA604QytMQJhc0FFft_r9RyO3nu3lXCb8ol3J7M3jrOo4zN1BupGwdj3l_bO6_UIZCWu3zANh7Zb8nwAAAP__B7BB2Q">