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

    <tr>
        <th>Summary</th>
        <td>
            ICE in `clang::Sema::CheckParmsForFunctionDef`
        </td>
    </tr>

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

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

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

<pre>
    ```cpp
template void _declval() template <   class >
using _call_result_t = decltype(_declval);
template < class , class Ty >
using _element_t = Ty ;
template < class... Ts,
           auto =
               []< class Self   >(
                            _fn) -> _call_result_t< _element_t< Self, Ts >> {} >
void _make_impl(class ;
decltype(_make_impl<>
```

https://godbolt.org/z/xdbG6E35r

<code>clang++: /root/llvm-project/clang/lib/Sema/SemaChecking.cpp:16075: bool clang::Sema::CheckParmsForFunctionDef(llvm::ArrayRef<clang::ParmVarDecl*>, bool): Assertion `Param && "null in a parameter list"' failed.</code>

<details>
<summary>Backtrace</summary>

```
clang++: /root/llvm-project/clang/lib/Sema/SemaChecking.cpp:16075: bool clang::Sema::CheckParmsForFunctionDef(llvm::ArrayRef<clang::ParmVarDecl*>, bool): Assertion `Param && "null in a parameter list"' 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-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++20 <source>
1.      <eof> parser at end of file
 #0 0x00005652ba4f547f llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3b7f47f)
 #1 0x00005652ba4f31bc llvm::sys::CleanupOnSignal(unsigned long) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3b7d1bc)
 #2 0x00005652ba43fe48 CrashRecoverySignalHandler(int) CrashRecoveryContext.cpp:0:0
 #3 0x00007fe48aafc420 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x14420)
 #4 0x00007fe48a5c900b raise (/lib/x86_64-linux-gnu/libc.so.6+0x4300b)
 #5 0x00007fe48a5a8859 abort (/lib/x86_64-linux-gnu/libc.so.6+0x22859)
 #6 0x00007fe48a5a8729 (/lib/x86_64-linux-gnu/libc.so.6+0x22729)
 #7 0x00007fe48a5b9fd6 (/lib/x86_64-linux-gnu/libc.so.6+0x33fd6)
 #8 0x00005652bce10852 clang::Sema::CheckParmsForFunctionDef(llvm::ArrayRef<clang::ParmVarDecl*>, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x649a852)
 #9 0x00005652bd388339 clang::Sema::CompleteLambdaCallOperator(clang::CXXMethodDecl*, clang::SourceLocation, clang::SourceLocation, clang::Expr*, clang::TypeSourceInfo*, clang::ConstexprSpecKind, clang::StorageClass, llvm::ArrayRef<clang::ParmVarDecl*>, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6a12339)
#10 0x00005652bd73b43c clang::TreeTransform<(anonymous namespace)::TemplateInstantiator>::TransformLambdaExpr(clang::LambdaExpr*) SemaTemplateInstantiate.cpp:0:0
#11 0x00005652bd73c0fe clang::TreeTransform<(anonymous namespace)::TemplateInstantiator>::TransformExpr(clang::Expr*) SemaTemplateInstantiate.cpp:0:0
#12 0x00005652bd73c229 clang::TreeTransform<(anonymous namespace)::TemplateInstantiator>::TransformExpr(clang::Expr*) SemaTemplateInstantiate.cpp:0:0
#13 0x00005652bd77063c clang::Sema::SubstExpr(clang::Expr*, clang::MultiLevelTemplateArgumentList const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6dfa63c)
#14 0x00005652bd5be961 SubstDefaultTemplateArgument(clang::Sema&, clang::TemplateDecl*, clang::SourceLocation, clang::SourceLocation, clang::NonTypeTemplateParmDecl*, llvm::ArrayRef<clang::TemplateArgument>, llvm::ArrayRef<clang::TemplateArgument>) (.isra.0) SemaTemplate.cpp:0:0
#15 0x00005652bd5c4852 clang::Sema::SubstDefaultTemplateArgumentIfAvailable(clang::TemplateDecl*, clang::SourceLocation, clang::SourceLocation, clang::Decl*, llvm::ArrayRef<clang::TemplateArgument>, llvm::ArrayRef<clang::TemplateArgument>, bool&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6c4e852)
#16 0x00005652bd6fc4c2 clang::Sema::FinishTemplateArgumentDeduction(clang::FunctionTemplateDecl*, llvm::SmallVectorImpl<clang::DeducedTemplateArgument>&, unsigned int, clang::FunctionDecl*&, clang::sema::TemplateDeductionInfo&, llvm::SmallVectorImpl<clang::Sema::OriginalCallArg> const*, bool, llvm::function_ref<bool ()>) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6d864c2)
#17 0x00005652bd6fe496 void llvm::function_ref<void ()>::callback_fn<clang::Sema::DeduceTemplateArguments(clang::FunctionTemplateDecl*, clang::TemplateArgumentListInfo*, clang::QualType, clang::FunctionDecl*&, clang::sema::TemplateDeductionInfo&, bool)::'lambda0'()>(long) SemaTemplateDeduction.cpp:0:0
#18 0x00005652bcd77845 clang::Sema::runWithSufficientStackSpace(clang::SourceLocation, llvm::function_ref<void ()>) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6401845)
#19 0x00005652bd6f6996 clang::Sema::DeduceTemplateArguments(clang::FunctionTemplateDecl*, clang::TemplateArgumentListInfo*, clang::QualType, clang::FunctionDecl*&, clang::sema::TemplateDeductionInfo&, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6d80996)
#20 0x00005652bd6f6f0b clang::Sema::DeduceTemplateArguments(clang::FunctionTemplateDecl*, clang::TemplateArgumentListInfo*, clang::FunctionDecl*&, clang::sema::TemplateDeductionInfo&, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6d80f0b)
#21 0x00005652bd4fe780 clang::Sema::ResolveSingleFunctionTemplateSpecialization(clang::OverloadExpr*, bool, clang::DeclAccessPair*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6b88780)
#22 0x00005652bd4ff0c3 clang::Sema::ResolveAndFixSingleFunctionTemplateSpecialization(clang::ActionResult<clang::Expr*, true>&, bool, bool, clang::SourceRange, clang::QualType, unsigned int) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6b890c3)
#23 0x00005652bd15ecae clang::Sema::CheckPlaceholderExpr(clang::Expr*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x67e8cae)
#24 0x00005652bd27aa91 clang::Sema::ActOnDecltypeExpression(clang::Expr*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6904a91)
#25 0x00005652bcc726d5 clang::Parser::ParseDecltypeSpecifier(clang::DeclSpec&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x62fc6d5)
#26 0x00005652bccaa2d9 clang::Parser::ParseOptionalCXXScopeSpecifier(clang::CXXScopeSpec&, clang::OpaquePtr<clang::QualType>, bool, bool, bool*, bool, clang::IdentifierInfo**, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x63342d9)
#27 0x00005652bcc29e13 clang::Parser::TryAnnotateCXXScopeToken(bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x62b3e13)
#28 0x00005652bcc60a51 clang::Parser::ParseDeclarationSpecifiers(clang::DeclSpec&, clang::Parser::ParsedTemplateInfo const&, clang::AccessSpecifier, clang::Parser::DeclSpecContext, clang::Parser::LateParsedAttrList*, clang::ImplicitTypenameContext) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x62eaa51)
#29 0x00005652bcc2a3fb clang::Parser::ParseDeclOrFunctionDefInternal(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec&, clang::AccessSpecifier) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x62b43fb)
#30 0x00005652bcc2ad2f clang::Parser::ParseDeclarationOrFunctionDefinition(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*, clang::AccessSpecifier) (.part.0) Parser.cpp:0:0
#31 0x00005652bcc316b9 clang::Parser::ParseExternalDeclaration(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x62bb6b9)
#32 0x00005652bcc3200d clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, clang::Sema::ModuleImportState&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x62bc00d)
#33 0x00005652bcc2604a clang::ParseAST(clang::Sema&, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x62b004a)
#34 0x00005652bb7317f8 clang::CodeGenAction::ExecuteAction() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4dbb7f8)
#35 0x00005652baf8b989 clang::FrontendAction::Execute() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4615989)
#36 0x00005652baf0f5c6 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x45995c6)
#37 0x00005652bb06fa47 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x46f9a47)
#38 0x00005652b79d969d cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x106369d)
#39 0x00005652b79d51fa ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&) driver.cpp:0:0
#40 0x00005652bad74dcd 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
#41 0x00005652ba440330 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3aca330)
#42 0x00005652bad7568f 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
#43 0x00005652bad3d23c clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x43c723c)
#44 0x00005652bad3dcdd 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+++0x43c7cdd)
#45 0x00005652bad45bad clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x43cfbad)
#46 0x00005652b79d7890 clang_main(int, char**, llvm::ToolContext const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x1061890)
#47 0x00005652b78df515 main (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xf69515)

```

</details>
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzsW1tz27iS_jX0C0oqEuD1wQ-KbM16NrPOxq7ZvKmaAChhAxFcAPTY8-u3QFIXUJckU1Z29pyjciKRABrdXze6Gw0SjBGrmvPbIPkQJHc30Nq10rd0XYGxN6Vib7dBGvZ_tGmC8C4IZ5ZvGgmWoxclGFoyTuULyADnAS7QrjEgc4QQlWAMCsh9P7Q1ol6hJQUpl5qbVtqlRQG5Q46IfWt4gPM9wSIgH0ZTOqoDTbz99fx2NAGXfMPrLfGuw1lK0-kUPZsAz_sOaP-B1ipH4KjBfX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