Issue 55686
Summary a variably-modified type should not be referenceable from a local class scope
Labels clang, c++, crash-on-invalid
Assignees
Reporter zygoloid
    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.)
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to