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

    <tr>
        <th>Summary</th>
        <td>
            [clang] unexpected type class: UNREACHABLE executed at ... TreeTransform.h
        </td>
    </tr>

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

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

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

<pre>
    Failure bisects to #147835. Live repro link: https://compiler-explorer.com/z/7TYx3b8bq

Reduced source:
```c++
#include <utility>

template <std::size_t... a, typename b>
bool c(b d, std::index_sequence<a...>) {
    return d(std::integral_constant<long, a>{}...);
}
template <int e, typename b>
bool f(b d) {
    return c(d, std::make_index_sequence<e>{});
}
struct g {
    ~g();
    virtual bool h(const int&) const;
};
template <typename i>
struct j : g {
    j(i);
    bool h(const int& k) const { return l.m(k); }
    i l;
};
template <typename n>
struct o {
    o() { j{*u}; }
    n* u;
};
template <int, typename... p>
struct q {
    static bool m(int) {
        return f<sizeof...(p)>([](auto... a) { return (p::m(a) && ...); });
    }
};
enum { r, s };
void t() { o<q<r, q<s>>>(); }
```

Crash:
```
unexpected type class
UNREACHABLE executed at /root/llvm-project/llvm/tools/clang/lib/Sema/TreeTransform.h:5430!
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace, preprocessed source, and associated run script.
Stack dump:
0.      Program arguments: /opt/compiler-explorer/clang-assertions-trunk/bin/clang++ -gdwarf-4 -g -o /app/output.s -mllvm --x86-asm-syntax=intel -fno-verbose-asm -S --gcc-toolchain=/opt/compiler-explorer/gcc-snapshot -fcolor-diagnostics -fno-crash-diagnostics <source>
1.      <eof> parser at end of file
2.      <source>:23:5: instantiating function definition 'o<q<0, q<1>>>::o'
3.      <source>:18:10: instantiating function definition 'j<q<0, q<1>>>::h'
4.      <source>:28:17: instantiating function definition 'q<0, q<1>>::m'
5.      <source>:8:6: instantiating function definition 'f<1, (lambda at <source>:29:32)>'
6.      <source>:4:6: instantiating function definition 'c<0UL, (lambda at <source>:29:32)>'
7.      <source>:29:32: instantiating function definition 'q<0, q<1>>::m(int)::(anonymous class)::operator()<std::integral_constant<long, 0>>'
...
 #8 0x000000000722d32d clang::TreeTransform<(anonymous namespace)::TemplateInstantiator>::TransformTypeInObjectScope(clang::TypeLocBuilder&, clang::TypeLoc, clang::QualType, clang::NamedDecl*) SemaTemplateInstantiate.cpp:0:0
 #9 0x000000000722da9f clang::TreeTransform<(anonymous namespace)::TemplateInstantiator>::TransformNestedNameSpecifierLoc(clang::NestedNameSpecifierLoc, clang::QualType, clang::NamedDecl*) SemaTemplateInstantiate.cpp:0:0
#10 0x0000000007235c08 clang::TreeTransform<(anonymous namespace)::TemplateInstantiator>::TransformDependentScopeDeclRefExpr(clang::DependentScopeDeclRefExpr*, bool, clang::TypeSourceInfo**) SemaTemplateInstantiate.cpp:0:0
#11 0x0000000007219b5d clang::TreeTransform<(anonymous namespace)::TemplateInstantiator>::TransformExpr(clang::Expr*) SemaTemplateInstantiate.cpp:0:0
#12 0x000000000724b2d6 clang::TreeTransform<(anonymous namespace)::TemplateInstantiator>::TransformCallExpr(clang::CallExpr*) SemaTemplateInstantiate.cpp:0:0
```
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJy0V01v2zoW_TX0hpAhkZYlL7xQnRhTIOi8afIWsyoo6spmQpEqSWWcLua3Dy5lO7bjdtKHl8INbH7cc-7R5eGV8F5tDMCS5J9IfjMRQ9hat3RD3zuQ2zCpbfOyXAulBwe0Vh5k8DRYShjPZkXJ8ym9U89AHfTOUq3ME-EV3YbQe8IrwtaEraXteqXBJbDrtXXgptJ2hK1_ELYuHv6943VZfydpRdLqKzSDhIZ6OzgJGCGtyDwdP5KwT_hJK8K4MlIPDVDCV0NQWoUXwm_HIAG6XosQ53xoMAqvvPoB38J0OqWCsBUNLz0Y0QGtx221tZ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