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

    <tr>
        <th>Summary</th>
        <td>
            Clang latest crashs on invalid use of lambda template pack vs single template
        </td>
    </tr>

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

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

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

<pre>
    Compiler Explorer: [https://godbolt.org/z/qGWGnb1Y8](https://godbolt.org/z/qGWGnb1Y8)

The `<typename... T>` should of course be just `<typename T>` but the prior causes a crash instead of recovering from the error.

```
#include <tuple>

int main()
{
    std::tuple<int, char> asd;

 auto per_type = []<typename... T>(T&& v){};

 std::apply([&]<typename... Ts>(Ts&&... v){(per_type(v), ...);}, asd);
}
```

```
clang++: /root/llvm-project/clang/lib/Sema/SemaTemplateInstantiate.cpp:2209: clang::QualType {anonymous}::TemplateInstantiator::TransformTemplateTypeParmType(clang::TypeLocBuilder&, clang::TemplateTypeParmTypeLoc, bool): Assertion `Arg.getKind() == TemplateArgument::Pack && "Missing argument pack"' failed.
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-17.0.1/bin/clang++ -gdwarf-4 -g -o /app/output.s -mllvm --x86-asm-syntax=intel -S --gcc-toolchain=/opt/compiler-explorer/gcc-13.2.0 -fcolor-diagnostics -fno-crash-diagnostics -std=c++20 <source>
1.      <source>:9:72: current parser token ')'
2.      <source>:4:1: parsing function body 'main'
3.      <source>:4:1: in compound statement ('{}')
4.      /opt/compiler-explorer/gcc-13.2.0/lib/gcc/x86_64-linux-gnu/13.2.0/../../../../include/c++/13.2.0/tuple:2294:5: instantiating function definition 'std::apply<(lambda at <source>:9:16), std::tuple<int, char> &>'
5.      /opt/compiler-explorer/gcc-13.2.0/lib/gcc/x86_64-linux-gnu/13.2.0/../../../../include/c++/13.2.0/tuple:2271:27: instantiating variable definition 'std::__unpack_std_tuple<std::is_nothrow_invocable, (lambda at <source>:9:16), std::tuple<int, char> &>'
6.      /opt/compiler-explorer/gcc-13.2.0/lib/gcc/x86_64-linux-gnu/13.2.0/../../../../include/c++/13.2.0/type_traits:3103:12: instantiating class definition 'std::is_nothrow_invocable<(lambda at <source>:9:16), int &, char &>'
7.      /opt/compiler-explorer/gcc-13.2.0/lib/gcc/x86_64-linux-gnu/13.2.0/../../../../include/c++/13.2.0/type_traits:176:12: instantiating class definition 'std::__and_<std::__is_invocable_impl<std::__invoke_result<(lambda at <source>:9:16), int &, char &>, void>, std::__call_is_nothrow<std::__invoke_result<(lambda at <source>:9:16), int &, char &>, (lambda at <source>:9:16), int &, char &>>'
8.      /opt/compiler-explorer/gcc-13.2.0/lib/gcc/x86_64-linux-gnu/13.2.0/../../../../include/c++/13.2.0/type_traits:2574:12: instantiating class definition 'std::__invoke_result<(lambda at <source>:9:16), int &, char &>'
9.      /opt/compiler-explorer/gcc-13.2.0/lib/gcc/x86_64-linux-gnu/13.2.0/../../../../include/c++/13.2.0/type_traits:2536:12: instantiating class definition 'std::__result_of_impl<false, false, (lambda at <source>:9:16), int &, char &>'
10.     <source>:9:16: instantiating function definition 'main()::(anonymous class)::operator()<int &, char &>'
  #0 0x00000000036e7558 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-17.0.1/bin/clang+++0x36e7558)
 #1 0x00000000036e53dc llvm::sys::CleanupOnSignal(unsigned long) (/opt/compiler-explorer/clang-assertions-17.0.1/bin/clang+++0x36e53dc)
 #2 0x0000000003632918 CrashRecoverySignalHandler(int) CrashRecoveryContext.cpp:0:0
  #3 0x00007f2737129420 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x14420)
  #4 0x00007f2736bec00b raise (/lib/x86_64-linux-gnu/libc.so.6+0x4300b)
  #5 0x00007f2736bcb859 abort (/lib/x86_64-linux-gnu/libc.so.6+0x22859)
  #6 0x00007f2736bcb729 (/lib/x86_64-linux-gnu/libc.so.6+0x22729)
  #7 0x00007f2736bdcfd6 (/lib/x86_64-linux-gnu/libc.so.6+0x33fd6)
  #8 0x00000000068d83c4 (anonymous namespace)::TemplateInstantiator::TransformTemplateTypeParmType(clang::TypeLocBuilder&, clang::TemplateTypeParmTypeLoc, bool) SemaTemplateInstantiate.cpp:0:0
  #9 0x00000000068f8af7 clang::TreeTransform<(anonymous namespace)::TemplateInstantiator>::TransformType(clang::TypeLocBuilder&, clang::TypeLoc) SemaTemplateInstantiate.cpp:0:0
 #10 0x00000000068fdd22 clang::TreeTransform<(anonymous namespace)::TemplateInstantiator>::TransformReferenceType(clang::TypeLocBuilder&, clang::ReferenceTypeLoc) SemaTemplateInstantiate.cpp:0:0
 #11 0x00000000068f899d clang::TreeTransform<(anonymous namespace)::TemplateInstantiator>::TransformType(clang::TypeLocBuilder&, clang::TypeLoc) SemaTemplateInstantiate.cpp:0:0
 #12 0x00000000068fe44a clang::TreeTransform<(anonymous namespace)::TemplateInstantiator>::TransformType(clang::TypeSourceInfo*) SemaTemplateInstantiate.cpp:0:0
 #13 0x00000000069069ea clang::Sema::SubstType(clang::TypeSourceInfo*, clang::MultiLevelTemplateArgumentList const&, clang::SourceLocation, clang::DeclarationName, bool) (/opt/compiler-explorer/clang-assertions-17.0.1/bin/clang+++0x69069ea)
 #14 0x0000000006910015 clang::Sema::SubstParmVarDecl(clang::ParmVarDecl*, clang::MultiLevelTemplateArgumentList const&, int, std::optional<unsigned int>, bool, bool) (/opt/compiler-explorer/clang-assertions-17.0.1/bin/clang+++0x6910015)
 #15 0x0000000006910fa0 clang::TreeTransform<(anonymous namespace)::TemplateInstantiator>::TransformFunctionTypeParams(clang::SourceLocation, llvm::ArrayRef<clang::ParmVarDecl*>, clang::QualType const*, clang::FunctionType::ExtParameterInfo const*, llvm::SmallVectorImpl<clang::QualType>&, llvm::SmallVectorImpl<clang::ParmVarDecl*>*, clang::Sema::ExtParameterInfoBuilder&, unsigned int*) SemaTemplateInstantiate.cpp:0:0
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzcWV1z27gV_TXwC4YcEvx-0IM-rG2m3jaNPdvpkwYEQQkbEGAB0LH76zsAIVmklaydtaeeZhxbAoFz7zm49-KSxFqzvaB0AbIVyDZXeDAHqRZSUD50TFzVsnlcrGXXM04VvH7ouVRUgWQJQbY6GNNrkCwB2gK03cumltyEUu0B2v4HoO2_f_nnL6KO_1WCbANQ-fLpqALRBkTL8ffdgUKQRyBZm8eeCtzRMAzhHUiuQR5BfZADb6BsIZGD0hTWFP4-aDNbcppfDwaaA4W9YlJBggdNNcSQKKwPkAltKHZoihJ5TxUTe9gq2bk1VCmpwnPfrJHxZ_yKEiYIHxoKre2h59SaPVvAhIEdZgKgM5rFavwAIYTaNFajZOlXr5kwAK0hOWAFkmuIdQOS1TkkxIORsKdqZ8lCkGzguJuXFEPlHUA5QDm8t_aLFSg2c7yTC7jv-aP1NFvZRc8RtYfUI6YdO8Ki8ugRQKUbRGsYhqH9lDiraO3IjN-9EJvLsl4aJByLPUAr-2PjEW2VlAagLef3XdAr-Tsl9quft-WsBmh7Szvs_9zRrufY0E9CGywMw4aGpO9BskQoqizmuNRJ8Y8B8zsnb7HCQorHTg7aaWevPoeSyl9RWOhWqu44xYJ8xqq7G5U5M2FHbiRZDYw3VDlF1-cuXEK4kcTOqqXkTsglXGpNlWFS2ARYqn24p-avTDRjwNnosAFyxFqq_dBRYUYLnzH5Cn14AIR-ZVrb-Md-Euwx-QoQAqiALWacNj4XPt9cL2-voR7qjhmIYT3soaK9VAYaCWd5z8xhqEMiO79Vz3eMaT1QDdAWYtHAY0LZBByztMbkq1GYUEu9V7RXklCtaQO1HNQ4bFdirSWx29pANQioiWK98S7fGsu1GTq73-NQFIKo-qzkXuHuxFn72JK9iyVfCQN6rIQ-vgJ8lF0HcRFGYQz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