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

    <tr>
        <th>Summary</th>
        <td>
            Assertion failure when indexing into non-existent pack
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

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

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

<pre>
    The following invalid translation unit

```cpp
bool b = a...[0];
```

causes clang to crash with

```console
Cannot print TypoExpr nodes
UNREACHABLE executed at /root/llvm-project/clang/lib/AST/StmtPrinter.cpp:2752!
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.      <source>:1:17: current parser token ';'
 #0 0x000000000393d208 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x393d208)
 #1 0x000000000393aeec llvm::sys::CleanupOnSignal(unsigned long) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x393aeec)
 #2 0x0000000003880fb8 CrashRecoverySignalHandler(int) CrashRecoveryContext.cpp:0:0
 #3 0x00007f4114242520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
 #4 0x00007f41142969fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc)
 #5 0x00007f4114242476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)
 #6 0x00007f41142287f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)
 #7 0x000000000388c24a (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x388c24a)
 #8 0x00000000076f9873 (anonymous namespace)::StmtPrinter::Visit(clang::Stmt*) StmtPrinter.cpp:0:0
 #9 0x00000000076f9e34 clang::Stmt::printPretty(llvm::raw_ostream&, clang::PrinterHelper*, clang::PrintingPolicy const&, unsigned int, llvm::StringRef, clang::ASTContext const*) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x76f9e34)
#10 0x000000000771a584 clang::StreamingDiagnostic const& DiagTemplateArg<clang::StreamingDiagnostic>(clang::StreamingDiagnostic const&, clang::TemplateArgument const&) TemplateBase.cpp:0:0
#11 0x0000000006e2a147 clang::Sema::ActOnPackIndexingExpr(clang::Scope*, clang::Expr*, clang::SourceLocation, clang::SourceLocation, clang::Expr*, clang::SourceLocation) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6e2a147)
#12 0x0000000006277edf clang::Parser::ParseCXXPackIndexingExpression(clang::ActionResult<clang::Expr*, true>) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6277edf)
#13 0x0000000006278031 clang::Parser::tryParseCXXPackIndexingExpression(clang::ActionResult<clang::Expr*, true>) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6278031)
#14 0x0000000006264bc8 clang::Parser::ParseCastExpression(clang::Parser::CastParseKind, bool, bool&, clang::Parser::TypeCastState, bool, bool*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6264bc8)
#15 0x00000000062669ca clang::Parser::ParseCastExpression(clang::Parser::CastParseKind, bool, clang::Parser::TypeCastState, bool, bool*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x62669ca)
#16 0x0000000006266b69 clang::Parser::ParseAssignmentExpression(clang::Parser::TypeCastState) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6266b69)
#17 0x0000000006223d17 clang::Parser::ParseDeclarationAfterDeclaratorAndAttributes(clang::Declarator&, clang::Parser::ParsedTemplateInfo const&, clang::Parser::ForRangeInit*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6223d17)
#18 0x0000000006232c1a 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+++0x6232c1a)
#19 0x00000000061f074e clang::Parser::ParseDeclOrFunctionDefInternal(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec&, clang::AccessSpecifier) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x61f074e)
#20 0x00000000061f0f43 clang::Parser::ParseDeclarationOrFunctionDefinition(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*, clang::AccessSpecifier) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x61f0f43)
#21 0x00000000061f8466 clang::Parser::ParseExternalDeclaration(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x61f8466)
#22 0x00000000061f930d clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, clang::Sema::ModuleImportState&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x61f930d)
#23 0x00000000061f97e0 clang::Parser::ParseFirstTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, clang::Sema::ModuleImportState&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x61f97e0)
#24 0x00000000061ebf2c clang::ParseAST(clang::Sema&, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x61ebf2c)
#25 0x00000000041edcb8 clang::CodeGenAction::ExecuteAction() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x41edcb8)
#26 0x000000000446d3c9 clang::FrontendAction::Execute() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x446d3c9)
#27 0x00000000043f624e clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x43f624e)
#28 0x000000000455062e clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x455062e)
#29 0x0000000000c45f8c cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xc45f8c)
#30 0x0000000000c3f21a ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&) driver.cpp:0:0
#31 0x0000000004230cd9 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
#32 0x0000000003881464 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3881464)
#33 0x00000000042312cf 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
#34 0x00000000041f7605 clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x41f7605)
#35 0x00000000041f806d 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+++0x41f806d)
#36 0x00000000041ffdf5 clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x41ffdf5)
#37 0x0000000000c43425 clang_main(int, char**, llvm::ToolContext const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xc43425)
#38 0x0000000000b26064 main (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xb26064)
#39 0x00007f4114229d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#40 0x00007f4114229e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#41 0x0000000000c3ed0e _start (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xc3ed0e)
clang++: error: clang frontend command failed with exit code 134 (use -v to see invocation)
Compiler returned: 134
```

See it live: https://godbolt.org/z/nsd16fohz
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzkmltzozgWgH8NeVHhAoG5POSBOPFMZnu3U-3s1Ly5hDjY2mCJlUTizK_fksAJIo67sxV37WVqMoOFdC6fjo4OCKIU23CAS29-5c2vL0int0JeVuSRVUoLDhelqJ4v77eAatE04onxDWL8kTSsQloSrhqimeCo40x7wbUXFMN_k6D_l7Zt31IK0aASedE1IrPZzJtfBd782ouuJgPGUijpFChEG8I3SAtEJVFb9MT09rguwZVooG9dEM6FRq1kXKP751bc7FuJuKhA9R3-_rdvN8Xi1-Lqyw2CPdBOQ4WIRh5eSiG0h5dN87jzWyn-AdT8tGaYZlZ6eFms7j28XOmdvjMqQM6Mq1GB0zn2cNjruPtyU6xukOrKHdOIoLLbIAmtkNq4s9W6VV5UeHjp4eWG6W1XzqjYDarfWsCU6kB5eIkIrxDjtOkqQHoLA5mS0ActCQUPL1AroZWCglJQISU62TebkUQpQRkxDsuOI0Ula_WsN3mlCX1AVbczzvRNwcwL8jspNpLsEJGbbgdcG8MNK9FaNmLXsgakD_u2ERLkgZdPlAJpYkT5Wnb8wcPLkvFXnFcevkL-pnoisvZj5G-QL4xc0rZGeqfbTs8U8neGBfL9fZb4RO189cw12XvRtYHfIH-FfH9Dqa-FaOiWMO5F1yfNM50VJ63aCo38mopGSL9iZMOF0owq5Ndc-Bas26x05UXXtDcdJ8iLFgPe6KYHFhpgTnNUh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