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

    <tr>
        <th>Summary</th>
        <td>
            [Clang] Expansion of pack indexing expression that is a pack in a lambda triggers ICE
        </td>
    </tr>

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

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

    <tr>
      <th>Reporter</th>
      <td>
          frederick-vs-ja
      </td>
    </tr>
</table>

<pre>
    It seems that some branches are missing for this case. [Godbolt link](https://godbolt.org/z/8YK9MGYdb).
```C++
#include <cstddef>
#include <utility>

void operate_one(auto&&) {}

void operate_multi(auto&&...args)
{
    [&]<std::size_t... idx>(std::index_sequence<idx...>)
    {
 (::operate_one(args...[idx]), ...);
 }(std::make_index_sequence<sizeof...(args)>{});
}

int main()
{
    ::operate_multi(1, 2, 3);
}
```

```
mangling a placeholder type
UNREACHABLE executed at /root/llvm-project/clang/lib/AST/ItaniumMangle.cpp:3339!
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 -S --gcc-toolchain=/opt/compiler-explorer/gcc-snapshot -fcolor-diagnostics -fno-crash-diagnostics -std=c++26 <source>
1.      <eof> parser at end of file
2.      <source>:6:6: instantiating function definition 'operate_multi<int, int, int>'
3.      <source>:4:6: instantiating function definition 'operate_one<<dependent type> &>'
4.      <source>:4:6: LLVM IR generation of declaration 'operate_one'
5.      <source>:4:6: Mangling declaration 'operate_one'
 #0 0x00000000039a02d8 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x39a02d8)
 #1 0x000000000399dfbc llvm::sys::CleanupOnSignal(unsigned long) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x399dfbc)
 #2 0x00000000038ef028 CrashRecoverySignalHandler(int) CrashRecoveryContext.cpp:0:0
 #3 0x0000752ae9242520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
 #4 0x0000752ae92969fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc)
 #5 0x0000752ae9242476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)
 #6 0x0000752ae92287f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)
 #7 0x00000000038fa34a (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x38fa34a)
 #8 0x000000000774cdb4 (anonymous namespace)::CXXNameMangler::mangleType(clang::QualType) ItaniumMangle.cpp:0:0
 #9 0x0000000007743d03 (anonymous namespace)::CXXNameMangler::mangleType(clang::QualType) ItaniumMangle.cpp:0:0
#10 0x0000000007762408 (anonymous namespace)::CXXNameMangler::mangleTemplateArg(clang::TemplateArgument, bool) ItaniumMangle.cpp:0:0
#11 0x000000000775f59f (anonymous namespace)::CXXNameMangler::mangleTemplateArgs(clang::TemplateName, clang::TemplateArgumentList const&) ItaniumMangle.cpp:0:0
#12 0x0000000007740843 (anonymous namespace)::CXXNameMangler::mangleNameWithAbiTags(clang::GlobalDecl, llvm::SmallVector<llvm::StringRef, 4u> const*) ItaniumMangle.cpp:0:0
#13 0x000000000774144a (anonymous namespace)::CXXNameMangler::mangleName(clang::GlobalDecl) ItaniumMangle.cpp:0:0
#14 0x000000000775875d (anonymous namespace)::CXXNameMangler::mangleFunctionEncoding(clang::GlobalDecl) ItaniumMangle.cpp:0:0
#15 0x000000000775c70e (anonymous namespace)::ItaniumMangleContextImpl::mangleCXXName(clang::GlobalDecl, llvm::raw_ostream&) ItaniumMangle.cpp:0:0
#16 0x0000000007781523 clang::MangleContext::mangleName(clang::GlobalDecl, llvm::raw_ostream&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x7781523)
#17 0x0000000003d743dc getMangledNameImpl(clang::CodeGen::CodeGenModule&, clang::GlobalDecl, clang::NamedDecl const*, bool) CodeGenModule.cpp:0:0
#18 0x0000000003d85fad clang::CodeGen::CodeGenModule::getMangledName(clang::GlobalDecl) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3d85fad)
#19 0x0000000003db795c clang::CodeGen::CodeGenModule::EmitGlobal(clang::GlobalDecl) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3db795c)
#20 0x0000000003dc1de3 clang::CodeGen::CodeGenModule::EmitTopLevelDecl(clang::Decl*) (.part.0) CodeGenModule.cpp:0:0
#21 0x000000000426ff86 (anonymous namespace)::CodeGeneratorImpl::HandleTopLevelDecl(clang::DeclGroupRef) ModuleBuilder.cpp:0:0
#22 0x00000000042604c8 clang::BackendConsumer::HandleTopLevelDecl(clang::DeclGroupRef) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x42604c8)
#23 0x0000000006f3816a clang::Sema::InstantiateFunctionDefinition(clang::SourceLocation, clang::FunctionDecl*, bool, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6f3816a)
#24 0x0000000006f3698f clang::Sema::PerformPendingInstantiations(bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6f3698f)
#25 0x0000000006f389b6 clang::Sema::InstantiateFunctionDefinition(clang::SourceLocation, clang::FunctionDecl*, bool, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6f389b6)
#26 0x0000000006f3698f clang::Sema::PerformPendingInstantiations(bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6f3698f)
#27 0x00000000064473bf clang::Sema::ActOnEndOfTranslationUnitFragment(clang::Sema::TUFragmentKind) (.part.0) Sema.cpp:0:0
#28 0x0000000006447ba2 clang::Sema::ActOnEndOfTranslationUnit() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6447ba2)
#29 0x00000000062c2d0a clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, clang::Sema::ModuleImportState&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x62c2d0a)
#30 0x00000000062b66ea clang::ParseAST(clang::Sema&, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x62b66ea)
#31 0x000000000426db08 clang::CodeGenAction::ExecuteAction() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x426db08)
#32 0x00000000044f1349 clang::FrontendAction::Execute() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x44f1349)
#33 0x0000000004478a2e clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4478a2e)
#34 0x00000000045d805e clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x45d805e)
#35 0x0000000000c526cc cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xc526cc)
#36 0x0000000000c4ba2a ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&) driver.cpp:0:0
#37 0x00000000042b0cd9 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
#38 0x00000000038ef4d4 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x38ef4d4)
#39 0x00000000042b12cf 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
#40 0x00000000042773d5 clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x42773d5)
#41 0x0000000004277e3d 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+++0x4277e3d)
#42 0x000000000427fb35 clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x427fb35)
#43 0x0000000000c4fbd5 clang_main(int, char**, llvm::ToolContext const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xc4fbd5)
#44 0x0000000000b31264 main (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xb31264)
#45 0x0000752ae9229d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#46 0x0000752ae9229e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#47 0x0000000000c4b4de _start (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xc4b4de)
clang++: error: clang frontend command failed with exit code 134 (use -v to see invocation)
Compiler returned: 134
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzkWl1z27bS_jX0DUYaCuDnhS9kyU7TJo3f2O3bXmlAAKRQkwALgK7cX38GIGURtOTaqd0z55yMY0v42H2exWJ3QRBrzSvB2HkQXwTx-gx3ZivVeakYZYqTu9m9nv2GzwpJH84_GqAZazQwW2yAlg0DhcKCbJkGWDHQcK25qEApFTBbrgHBms1BEF98kLSQtQE1F3dBvA5gtjWm1QFaBvAqgFdV3z-Xqgrg1Z8BvMp-_SH__OFXWgQwnwfhOgiXQRL2P6sAXtifvhUiLkjdUQYCtCLaUMrKAF0e6-0Mr7l5OPS63_eSUyBbprBhGylYADPcGRnAxP3kIEgvgnR9ckrT1YZ7k-bzOVaVDmA-TEoHsAAAaw47Kl4HaKUNtTZAS83_ZBszn88BpzuLD2aPfVxQ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