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

    <tr>
        <th>Summary</th>
        <td>
            Clang frontend C++ crash on invalid code when using some built-in type traits
        </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/K1sTM53s7

```cpp
#include <type_traits>
#include <cstddef>

enum Day {
    sunday, monday, tuesday, wednesday,
    thursday, friday, saturday
};

class A {};

int main() {
   std::__add_rvalue_reference<A>::type ptr; // swap __add_rvalue_reference for (__add_pointer or __add_rvalue_reference) also leads to same crash
}
```

Compiling the above invalid code crashes clang `clang++ -x c++ -std=c++23`, crashes locally using clang-17.0 (a10019a), also on trunk (see godbolt link)

Note: Also tested with other built-in type traits like `__add_pointer` and `__add_rvalue_reference` and also leads to the same crash. Not sure if there could be more.



</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJx0VM-T6yYM_mvwRZOMDVknPviQH82l03d69wwGJaaLwQWRbfrXd3CcZtPdN-PBAn1CfJ8EMkZzcYgte9uxt0MhE_U-tF1IJG2UV3nBovP61v708Fcy6t3eIOAYvE4KmdhCTzRGJraMHxk_XpRaXrzuvKWlDxfGj_8wfvy9ij__eBNxzcoDK7fzWJf3T43jvMKFccomjcDEnm4jnihIQ5GJ375DqEha4_npnUZ0aYCDvAFb7-4rAAAxOS1vjO9h8A-LEsbZ_EDtHpNnEPUpPBDnYGYrSkoh2_ek6wMTu88HUFbGCNsp_xencQSDNI7xDePNyxkj6ayj2J5OUutTuEqb8BTwjAFdFnu_zVQnSBYHRgpM7OCuPMQPOcL3oXD2ARjf3L2jN44wgA-_gOeDSRs9WJQ6AnmIckBQQcb-Sfq1iJ857v0wGmvcBahHkJ2_Ihh3ldZoUF7PO2EEZaW7QG6BbDC-Y3wHi79BPcxJksM85SLn4fv_wq1X0tobpJhzTXssqvWyzFRlVZZVIxlvcsTExjugkNx7dkdEmPsUrHHvGfeJwQ9PU3NvcxxhJNTwYagHTz0G6JKxtDAOpjLcexSsecfM5UVkVpcgnX6uf9F6BrzqnXV7ar6EH54gpoBgztkXEJRPVkOHMPiAy5d7NY2FboVuRCMLbKt6U6_EWqzLom_FZlVuVNfoNyXlujqrplNNiRWqWqm6bgrT8pKLsq5KzleNKJeVEFpi3a1qrKvuXLNViYM0dmntdci3vDAxJmxrwVeisLJDGx_PSWgzaNGlS2Sr0ppI8RlGhiy2-6kJzsE7QqdhP9d-Yp5r9tI5Hz26ud7RD_htJYoUbPu_Z8lQn7ql8gPjx5x__i3G4P9ERYwfJw6R8eNE498AAAD__26vmGE">