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

    <tr>
        <th>Summary</th>
        <td>
            clang-tidy [gogole-readability-casting] module warning about c-style cast in throw statement
        </td>
    </tr>

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

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

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

<pre>
    I have a small test case here which illustrates the problem I've been having

```
#include <stdexcept>

uint64_t bar(int a1, ...);

template <typename T>
int64_t foo(T val)
{
  const int64_t status = bar(0, val);
  if (status != 0) {
    throw std::runtime_error(std::to_string(status));
  }

  return status;
}
```

When I run clang-tidy on it eg `clang-tidy -checks=google-readability-casting tidy_test.cpp` I get
```
warning: C-style casts are discouraged; use static_cast/const_cast/reinterpret_cast [google-readability-casting]
    throw std::runtime_error(std::to_string(status));
          ^
Suppressed 11 warnings (11 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
```

I don't see this issue with clang-tidy 12, but I saw it starting version 14.0.0, and also confirmed on a few other versions including 14.0.6, 15.0.1, and trunk (using godbolt).
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy1VE2PmzAQ_TVwGYH4TMKBw-6mK-25rXqMjD0Bd42NbLNp_n3HBLZp1e2tkUUwnnl-8_zGnRHX9gUG9obAwI1MKfDoPHDmEAa0CJdB8gGkUrPzltEi-AFhsqZTOMJLVOwpt0PUAUXqPsqOUfawPnfZOm7TopSaq1kgROWT8wJ_cJx8VH66T5ql9rvq5KFjNioONAOWR8UTpGkaFU1UPt5HexwnRbQCor9OqNmI8OUdcsM6G0NYX-CNqYBxA9ivSADcaCp6C3ae-dkR4nHlkIXt19TyPUmegda24CIP8RTZwB0wkFrWXAhSROUDDTtrL0c8obXGLunrgjcnEjgIuGGG3X7bMNof70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