Skip to content

[clang] unexpected type class: UNREACHABLE executed at ... TreeTransform.h #154270

@rupprecht

Description

@rupprecht

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

Reduced source:

#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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions