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

    <tr>
        <th>Summary</th>
        <td>
            a variably-modified type should not be referenceable from a local class scope
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            clang,
            c++,
            crash-on-invalid
      </td>
    </tr>

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

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

<pre>
    Various lines of this testcase cause Clang to crash:

```
void f(int n) {
  using T = int[n];
  struct A {
    using U = T;
    void f() { U u; }
    void g() { T t; }
  };
  A::U u;
  A a;
  a.f();
  a.g();
}
```

Most of this is pretty clearly unsupportable: in particular, the calls to `A::f` and `A::g` don't provide the value of the VLA bound, so those functions shouldn't be able to use the type. Probably the best rule here is that a variably-modified type is simply not referenceable at all from within a local class. (Note that we *do* allow this from within a local lambda, and have special logic to capture the type.)
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJx1VEuP2yAQ_jX4Mkrk2uvEOfiQbNRTW_Ww3TuGsU1FwOKRVfrrO-BsNhu1EsLM45vHN-Deykv3yp2y0YNWBj3YAcKkPAT0QXCPIHik_VlzM0KwIBz3E6v3rDyy8n3flNeVxbNVEgZWtcoEMKzaAdseFhNA9IoCvQCrj0B21hwMa46svjn44KIIsL8HvcN-ZdjLnTfALds1ETlFcqDj8cFpvHN6gfDglI4fcfepxXq_xLopgd9JfH3N-kk3PuhuGR5IWvbv1ocb5bRmhyFcQGjkTl8gGh_n2brAe41UDjEGM3dBiai5Y9UzAdOEtPZpNhT8WvdAR-BG3qnGpJKW5rENlMeelcQMP3MdcSkC4fXbHnobjUzBvSWdpekP0YigrPHgJxu1XIL0CKmulDldkQQPlxnX8NPZniyXrOrpIoGL5Dehw9RkmHgATnmdSl6rk5VqUCgzOjl4dZoJbSwBcSCUEZgzJZzWMDh7gjdFpBmKoy0RQJRx79dA7P-wAZccb0jyXlraEs6-LTz_C675qZc8NZ1Ym_gZwc8oVDLZUYl89fkcortrlOZcyK6Wu3rHi6CCxu6_bS3E5Z6It89t5YI-NQJe2BmL6HQ3hTD7NMLqK62Ryo79WtgTCVqf3z8rmuhvFIFE5X1ET4em2bSbYuo2rRhEK0W9q_rNduibgbfY1GWzQVlh9aXQvEftO3qLrKpEeun0TVwkkVWHvG6K9ANYWbNShm6OksnSHAvVVWVVlU3VlGW9LZv1th44b9unoR3avpTInko8caXXqdy1dWPhulx5H0dPRq188B9GIkGNBjFXRfF5pKvouj-X0Wp6zEXussst_gXkI3kz">