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

    <tr>
        <th>Summary</th>
        <td>
            clang-tidy 17.0.2 check google-readability-casting false-positive result for std::vector constructor call
        </td>
    </tr>

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

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

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

<pre>
    This code triggers an incorrect cast warning for a std::vector constructor call in clang-tidy 17.0.2:
```c++
#include <vector>

template<typename T>
class MatrixOperation
{
public:
    void performOperation();
private:
    std::vector<double> m_x;
};

template<typename T>
void MatrixOperation<T>::performOperation()
{
    const std::size_t n=m_x.size();
    std::vector<std::vector<double>> matrix(n);
 for(size_t i=0; i<n; ++i)
 matrix[i]=std::vector<double>(n);
}

int main()
{
 MatrixOperation<std::string>().performOperation();
    return 0;
}
```
The emitted clang-tidy warning:
```console
main.cpp:18:19: warning: C-style casts are discouraged; use static_cast/const_cast/reinterpret_cast [google-readability-casting]
   18 | matrix[i]=std::vector<double>(n);
      | ^
```



</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJykVM2O4ygQfprKpZQIQxzbBx_yM7mt9tL3FsYVhx0MFuBsZ59-hZ1OMj3dMytt5GDAVH0_QMkQdGeJash3kB8Wcoxn5-vhu6mKRePaa_1y1gGVawmj111HPqC0qK1y3pOKqGSI-Lf0VtsOT86jxBBbEFsQ2wup6DwqZ0P049yXxqC2qIy03TLq9opZsWIrniLYAdgWNmx-FPBdeuZZLrRVZmwJQeznxCC-3T5ObaR-MDISiH28DmRlT_hyX6OMDAH_kNHrtz8H8jJqZ2_hxQ1kGBuj1Z0JIuLF6RYH8ifn-0cYL4FXIN7DvL5MuE9xHzwAsW_d2BgC8Q3717d7LBSHR_8_yJj4fFQh9tOCCe8Lrj8KTQynXXnwDPofeo1oQRz617dVGn6Q-bmsXwidtE5UgZf2h1Qn54GXN0wN4sBA7FJnb1Nn3nl9J_6eJt9pyA8gDr9C_YCVHH6yV9uIvdRf-PKzsw-Dote2mwGAV6vfHIrklqc4eovsEy7vh3wevpwJqdcxUvt8M27X6pOr4WxwhubZpGalhgHENitTU4HYPsXifhni1dB0VQNKT9jqoNzoZUdtsnsMhCHKqNVrWgP8OB2O94EnbSP5wdM8hZDvOuc6Q0tPspWNNjpel-lTQswPdweyEqHY_5_dw-mXkkD-7VPvnttFW4u2EpVcUJ1tqpKVYlOWi3NdndiGqSZjhSoblknWMmrZqSEpM8FLudA1Z1xk6V_k63W5EqLIxVplbFOIlrUnWDPqpTYrYy79yvluoUMYqd5UVb5eGNmQCVMV5fyxg8B5qqq-TkHLZuwCrJnRIYZHmqijofqneojqTOo7fu0znqQJtBxc0FFfCD2F0cSpBP-uAC9Gb-pzjENIy_gR-LHT8Tw2K-V64MfE7fZaDt79RSodg0lvAH6cJP8bAAD__6Bd4HM">