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

    <tr>
        <th>Summary</th>
        <td>
            [clang-tidy] modernize-min-max-use-initializer-list
        </td>
    </tr>

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

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

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

<pre>
    Running the recently intoroduced clang-tidy check `modernize-min-max-use-initializer-list` on the following valid code snippet triggers an assertion:

```
clang-tidy: /LLVM/llvm-project/llvm/include/llvm/Support/Casting.h:706: auto llvm::cast_if_present(Y*) [with X = clang::Expr; Y = const clang::Stmt]: Assertion `isa<X>(Val) && "cast_if_present<Ty>() argument of incompatible type!"' failed.
```
```
#include <algorithm>

int x() const;
int y() const;
int z() const;

int foo()
{
  return std::max(x(), std::max(y(), z()));
}
```

Stacktrace attached
[Crash.txt](https://github.com/llvm/llvm-project/files/15296684/Crash.txt)

</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyUVE2P2zgM_TX0RUhgU_FHDj7kozl1L53FoD0ViszY2sqSIdHtZH79wo6nGQSzwBYQBMuP4nt8kqhiNK0jqiHfQ35M1MidD_XzFzK6I8vJ2TfX-svonHGt4I5EIE2O7VUYxz74ZtTUCG2Va1dsmqvQHekfAoq09w0FZ15p1Ru36tXLaoy0Ms6wUda8UlhZExmKVHg3Z754a_2vieensqYR2jckojPDQCw4mLalEIVyQsVIgY13IHeQHiF9m4t0GfPyLgrkTgCePn9-_gvwZO3PfjUE_w9pXpaAJ-O0HRu6_3gah8GHKeKgIhvXrjuQuzItpmxqZC_mQLkDudMq8ndz-T4EiuQYsPoGuAPcCsj3vwx34qsAebz5dNvy6WUIIPfi2w3wLvJ7-Il7hvw4ce3eyp1cNVGBPHwF-QmwelZ25sACsBCA-KhDHv6-3kKnOBXasSfHwl-Ecdr3g2JztiT4OhBgBoiApbgoY6lZf-jp4xLl4psAeVC29cFw10-U787FOBYvi4a5UJD7O3L9T-T1Q-SOX7y_RSxAuUQIEYjH4ETk5uZmryb-RQPg4RG53pHXt895_CYtjx8bMM9PrPQPDkqTUMxKd9QscL4_BBW7Nb_Mp4lVxzzEiRpPgKfWcDee19r393v3cD0vxlIEPGU5boui2kz38XfKt9KTppbNVm5VQnVWZnmRyRLLpKvLHC9FuS3Om6rKU0wl0TbDLMtKhYWUTWJqTHGT5pnMcsS0XOumSDNs9KaiC1USYZNSr4xdT7rWPrSJiXGkepttK0ysOpONc_dAfPfgEKduEuq5mPPYRtik03OP9zRs2M595922_Cj-X9tIxmDrP_ZyVj6ZOYv_NwAA__-0KII-">