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

    <tr>
        <th>Summary</th>
        <td>
            [clang] -fexperimental-new-constant-interpreter option causes a crash, UNREACHABLE executed after saying "invalid type: emitCast"
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            clang:frontend,
            crash
      </td>
    </tr>

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

    <tr>
      <th>Reporter</th>
      <td>
          k-arrows
      </td>
    </tr>
</table>

<pre>
    Reproducer:
https://godbolt.org/z/E5o8qeWx6
```cpp
namespace std {
template <class T> struct initializer_list {
private:
  const T *_M_array;
  __SIZE_TYPE__ _M_len;
};
}
struct D {
  D (std::initializer_list<float>);
};
D d {
#embed __FILE__
};
```

Backtrace:
```console
invalid type: emitCast
UNREACHABLE executed at /root/build/tools/clang/lib/AST/Opcodes.inc:5450!
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 -fexperimental-new-constant-interpreter <source>
1.      <source>:13:2: current parser token ';'
 #0 0x0000000003ff1df8 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3ff1df8)
 #1 0x0000000003fef224 llvm::sys::CleanupOnSignal(unsigned long) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3fef224)
 #2 0x0000000003f33b68 CrashRecoverySignalHandler(int) CrashRecoveryContext.cpp:0:0
 #3 0x00007a1814e42520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
 #4 0x00007a1814e969fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc)
 #5 0x00007a1814e42476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)
 #6 0x00007a1814e287f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)
 #7 0x0000000003f3f1ca (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3f3f1ca)
 #8 0x0000000007a1a13b clang::interp::EvalEmitter::emitCast(clang::interp::PrimType, clang::interp::PrimType, clang::interp::SourceInfo const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x7a1a13b)
 #9 0x0000000007dfceea clang::interp::Compiler<clang::interp::EvalEmitter>::visitInitList(llvm::ArrayRef<clang::Expr const*>, clang::Expr const*, clang::Expr const*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x7dfceea)
#10 0x0000000007de99fe clang::interp::Compiler<clang::interp::EvalEmitter>::visitInitializer(clang::Expr const*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x7de99fe)
#11 0x0000000007dfbdd1 clang::interp::Compiler<clang::interp::EvalEmitter>::VisitMaterializeTemporaryExpr(clang::MaterializeTemporaryExpr const*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x7dfbdd1)
#12 0x0000000007df59ba clang::interp::Compiler<clang::interp::EvalEmitter>::visit(clang::Expr const*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x7df59ba)
#13 0x0000000007dc259b clang::interp::Compiler<clang::interp::EvalEmitter>::VisitCXXStdInitializerListExpr(clang::CXXStdInitializerListExpr const*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x7dc259b)
#14 0x0000000007de99fe clang::interp::Compiler<clang::interp::EvalEmitter>::visitInitializer(clang::Expr const*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x7de99fe)
#15 0x0000000007df5ab7 clang::interp::Compiler<clang::interp::EvalEmitter>::visit(clang::Expr const*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x7df5ab7)
#16 0x0000000007dea2ca clang::interp::Compiler<clang::interp::EvalEmitter>::VisitCXXConstructExpr(clang::CXXConstructExpr const*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x7dea2ca)
#17 0x0000000007dfb825 clang::interp::Compiler<clang::interp::EvalEmitter>::VisitExprWithCleanups(clang::ExprWithCleanups const*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x7dfb825)
#18 0x0000000007de99fe clang::interp::Compiler<clang::interp::EvalEmitter>::visitInitializer(clang::Expr const*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x7de99fe)
#19 0x0000000007deaeee clang::interp::Compiler<clang::interp::EvalEmitter>::visitVarDecl(clang::VarDecl const*, bool, bool)::'lambda0'(unsigned int)::operator()(unsigned int) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x7deaeee)
#20 0x0000000007deb41a clang::interp::Compiler<clang::interp::EvalEmitter>::visitVarDecl(clang::VarDecl const*, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x7deb41a)
#21 0x0000000007deb874 clang::interp::Compiler<clang::interp::EvalEmitter>::visitDeclAndReturn(clang::VarDecl const*, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x7deb874)
#22 0x0000000007997417 clang::interp::EvalEmitter::interpretDecl(clang::VarDecl const*, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x7997417)
#23 0x00000000079799bd clang::interp::Context::evaluateAsInitializer(clang::interp::State&, clang::VarDecl const*, clang::APValue&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x79799bd)
#24 0x0000000007952473 clang::Expr::EvaluateAsInitializer(clang::APValue&, clang::ASTContext const&, clang::VarDecl const*, llvm::SmallVectorImpl<std::pair<clang::SourceLocation, clang::PartialDiagnostic>>&, bool) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x7952473)
#25 0x000000000776d6d2 clang::VarDecl::evaluateValueImpl(llvm::SmallVectorImpl<std::pair<clang::SourceLocation, clang::PartialDiagnostic>>&, bool) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x776d6d2)
#26 0x000000000776da81 clang::VarDecl::checkForConstantInitialization(llvm::SmallVectorImpl<std::pair<clang::SourceLocation, clang::PartialDiagnostic>>&) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x776da81)
#27 0x0000000006a7020b clang::Sema::CheckCompleteVariableDeclaration(clang::VarDecl*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6a7020b)
#28 0x0000000006a7792b clang::Sema::AddInitializerToDecl(clang::Decl*, clang::Expr*, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6a7792b)
#29 0x00000000066dab9d clang::Parser::ParseDeclarationAfterDeclaratorAndAttributes(clang::Declarator&, clang::Parser::ParsedTemplateInfo const&, clang::Parser::ForRangeInit*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x66dab9d)
#30 0x00000000066e9a29 clang::Parser::ParseDeclGroup(clang::ParsingDeclSpec&, clang::DeclaratorContext, clang::ParsedAttributes&, clang::Parser::ParsedTemplateInfo&, clang::SourceLocation*, clang::Parser::ForRangeInit*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x66e9a29)
#31 0x00000000066a741e clang::Parser::ParseDeclOrFunctionDefInternal(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec&, clang::AccessSpecifier) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x66a741e)
#32 0x00000000066a7baf clang::Parser::ParseDeclarationOrFunctionDefinition(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*, clang::AccessSpecifier) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x66a7baf)
#33 0x00000000066af8ba clang::Parser::ParseExternalDeclaration(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x66af8ba)
#34 0x00000000066b0845 clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, clang::Sema::ModuleImportState&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x66b0845)
#35 0x00000000066a259a clang::ParseAST(clang::Sema&, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x66a259a)
#36 0x00000000049986e8 clang::CodeGenAction::ExecuteAction() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x49986e8)
#37 0x0000000004c8caf5 clang::FrontendAction::Execute() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4c8caf5)
#38 0x0000000004c08e2e clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4c08e2e)
#39 0x0000000004d81611 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4d81611)
#40 0x0000000000daeb8f cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xdaeb8f)
#41 0x0000000000da583a ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&) driver.cpp:0:0
#42 0x00000000049ffff9 void llvm::function_ref<void ()>::callback_fn<clang::driver::CC1Command::Execute(llvm::ArrayRef<std::optional<llvm::StringRef>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, bool*) const::'lambda'()>(long) Job.cpp:0:0
#43 0x0000000003f34004 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3f34004)
#44 0x0000000004a0060f clang::driver::CC1Command::Execute(llvm::ArrayRef<std::optional<llvm::StringRef>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, bool*) const (.part.0) Job.cpp:0:0
#45 0x00000000049c28ad clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x49c28ad)
#46 0x00000000049c393e clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&, bool) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x49c393e)
#47 0x00000000049cb385 clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x49cb385)
#48 0x0000000000dab045 clang_main(int, char**, llvm::ToolContext const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xdab045)
#49 0x0000000000c5f114 main (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xc5f114)
#50 0x00007a1814e29d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#51 0x00007a1814e29e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#52 0x0000000000da52e5 _start (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xda52e5)
clang++: error: clang frontend command failed with exit code 134 (use -v to see invocation)
Compiler returned: 134
```
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJzkm11zoziXxz8NuVHhAvF-kQvi2DM91b2d6mR7ZveGEuLgaIMRIwm3M59-S4CNheN0Z57QFzNT0xWM3s7_pyPpSACRkm1qgGsruLGC2yvSqkcurp9sIgT_Jq9yXjxff4FG8KKlICwvtZz0UalG6ku8tvB6w4ucV2rBxcbC678svF4FPP4Tft-HlpNaodP_T5vGctKabEE2hAKSqkBWdGM5qYJtUxEFyPKWtCJSogfLWyGpREsVYjVTjFTsLxBZxaQaCjWC7YiC3iCEKK-lQg_Iwmn2KSNCkGfLu-mSsuz-w_-usof_uVtlGco-ZRXUfZoV3Y4XTjo0eDu0gPQVjqUqdCNeOjXE8pZlxYmyvJWFk0mN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