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

    <tr>
        <th>Summary</th>
        <td>
            Clang frontend C++ crash when casting `string` to `char[]`
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
      </td>
    </tr>

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

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

<pre>
    To quickly reproduce: https://gcc.godbolt.org/z/ve4bK48nb (assertion-trunk)

```cpp
#include <string>

int main() {
 int index = 0;
  auto words = (char[]) std::to_string(index); // forbids casting to array type according to ISO C++ standard
}
```

Compiling the above code crashes clang `clang++ -x c++ --std=c++20 `, crashes locally using clang-17.0 (a10019a), also on trunk with assertion (see godbolt link)
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJxcU8tu4zgQ_JrWpWGDIq3XQQc_VsBiD3vYvQ_4isQJTWpIyonn6weUFScIYFhUd7O6q6rFYzSj07qH6gTVpeBLmnzoRVgSt5Hf-KgL4dW9_9_jr8XIV3vHoOfg1SI1sCNOKc0R2BHoAHQYpdyPXglv096HEejwG-hw0wfxz6F1AoG2PEYdkvFul8LiXoF2QC5Ajtt_TR4_Oc9bhDLjpF2URmDnmIJxI7C_vl4yLuGVGwe0BdohNKdHHHPCOKXfEdgFCbCPBPIleXzzQcU1BbSVEw8PETJGTCqTYsfkf2w9abtC5YHZCR988cUHYVREyWMybsTkkYfA75jus0YupQ9qi__93794BnoCesKYuFM8qI1Fc_nG_iu7s7_Oxq4gk0Yu_E2j9EqjDDxOOqK03I2YNcuHrcPuHeXHcbeyuWzvlORaoOcngPWSW3vHJeYuK8qubPZktaskpOx4Zk3PyG306B2u1uGbSRM-_czVUWvc_EdrVncL1TPVsY4Xui_rtm0rUpWHYupVyUvVlaoqBe86JppDJTWXnSjrthOlKExPCWWkIS0tScsO-1pXjSBKCN7IFyE7OBB95cburb1d874VJsZF9zVrqrawXGgbPxY79LloJ5YxwoFYE1P8vJZMsro_rzq-BO-Sdurp1aoSvk3aPV2GmmxLUZNsbdb-c31qUizB9t--DJOmReylvwIdcuPtsZuD_6llAjqsw0egwzr_nwAAAP__fzcZtw">