<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/113762>113762</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[clang] Assertion `(!Unexpanded.empty() || LambdaReferencingOuterPacks) && "Unable to find unexpanded parameter packs"' failed. at clang::Sema::ActOnFinishFullExpr
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang:frontend,
crash-on-invalid,
clang:frontend:fuzzer
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
yijan4845
</td>
</tr>
</table>
<pre>
**This testcase is generated by a fuzzer.**
Compiler Explorer: [https://godbolt.org/z/6c5b51jGW](https://godbolt.org/z/6c5b51jGW)
This invalid code will crash on Clang Assertion Trunk.
```cpp
template<typename T> using Int = int;
template<typename ...Ts> void Pack() {
Int<Ts>({});
}
template void Pack<>();
```
It seems that this goes back to clang-12. The compiler gets the same assertion fail with [113598](https://github.com/llvm/llvm-project/issues/113598) but in the different function.
Stack dump:
```
clang++: /root/llvm-project/clang/lib/Sema/SemaTemplateVariadic.cpp:473: bool clang::Sema::DiagnoseUnexpandedParameterPack(clang::Expr*, clang::Sema::UnexpandedParameterPackContext): Assertion `(!Unexpanded.empty() || LambdaReferencingOuterPacks) && "Unable to find unexpanded parameter packs"' 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 -fno-verbose-asm -S --gcc-toolchain=/opt/compiler-explorer/gcc-snapshot -fcolor-diagnostics -fno-crash-diagnostics <source>
1. <source>:4:1: current parser token '}'
2. <source>:2:38: parsing function body 'Pack'
3. <source>:2:38: in compound statement ('{}')
#0 0x0000000003bd9c18 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3bd9c18)
#1 0x0000000003bd78dc llvm::sys::CleanupOnSignal(unsigned long) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3bd78dc)
#2 0x0000000003b24f68 CrashRecoverySignalHandler(int) CrashRecoveryContext.cpp:0:0
#3 0x000075d3e9842520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
#4 0x000075d3e98969fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc)
#5 0x000075d3e9842476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)
#6 0x000075d3e98287f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)
#7 0x000075d3e982871b (/lib/x86_64-linux-gnu/libc.so.6+0x2871b)
#8 0x000075d3e9839e96 (/lib/x86_64-linux-gnu/libc.so.6+0x39e96)
#9 0x00000000074f36fc (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x74f36fc)
#10 0x0000000006ddbbfe clang::Sema::ActOnFinishFullExpr(clang::Expr*, clang::SourceLocation, bool, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6ddbbfe)
#11 0x00000000071851ee clang::Sema::ActOnExprStmt(clang::ActionResult<clang::Expr*, true>, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x71851ee)
#12 0x00000000067aee44 clang::Parser::ParseExprStatement(clang::Parser::ParsedStmtContext) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x67aee44)
#13 0x00000000067a511c clang::Parser::ParseStatementOrDeclarationAfterAttributes(llvm::SmallVector<clang::Stmt*, 32u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*, clang::ParsedAttributes&, clang::ParsedAttributes&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x67a511c)
#14 0x00000000067a6030 clang::Parser::ParseStatementOrDeclaration(llvm::SmallVector<clang::Stmt*, 32u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x67a6030)
#15 0x00000000067a6f05 clang::Parser::ParseCompoundStatementBody(bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x67a6f05)
#16 0x00000000067a865a clang::Parser::ParseFunctionStatementBody(clang::Decl*, clang::Parser::ParseScope&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x67a865a)
#17 0x00000000066bc1e3 clang::Parser::ParseFunctionDefinition(clang::ParsingDeclarator&, clang::Parser::ParsedTemplateInfo const&, clang::Parser::LateParsedAttrList*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x66bc1e3)
#18 0x00000000066f089d 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+++0x66f089d)
#19 0x00000000067ba056 clang::Parser::ParseDeclarationAfterTemplate(clang::DeclaratorContext, clang::Parser::ParsedTemplateInfo&, clang::ParsingDeclRAIIObject&, clang::SourceLocation&, clang::ParsedAttributes&, clang::AccessSpecifier) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x67ba056)
#20 0x00000000067c791c clang::Parser::ParseTemplateDeclarationOrSpecialization(clang::DeclaratorContext, clang::SourceLocation&, clang::ParsedAttributes&, clang::AccessSpecifier) (.part.0) ParseTemplate.cpp:0:0
#21 0x00000000067c7c3a clang::Parser::ParseDeclarationStartingWithTemplate(clang::DeclaratorContext, clang::SourceLocation&, clang::ParsedAttributes&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x67c7c3a)
#22 0x00000000066f8e43 clang::Parser::ParseDeclaration(clang::DeclaratorContext, clang::SourceLocation&, clang::ParsedAttributes&, clang::ParsedAttributes&, clang::SourceLocation*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x66f8e43)
#23 0x00000000066b7ec7 clang::Parser::ParseExternalDeclaration(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x66b7ec7)
#24 0x00000000066b8d6d clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, clang::Sema::ModuleImportState&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x66b8d6d)
#25 0x00000000066ab28a clang::ParseAST(clang::Sema&, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x66ab28a)
#26 0x0000000004550478 clang::CodeGenAction::ExecuteAction() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4550478)
#27 0x000000000480c359 clang::FrontendAction::Execute() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x480c359)
#28 0x000000000478ae4e clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x478ae4e)
#29 0x00000000048f1bee clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x48f1bee)
#30 0x0000000000ce2d9f cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xce2d9f)
#31 0x0000000000cdaa6a ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&) driver.cpp:0:0
#32 0x0000000004594119 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
#33 0x0000000003b25414 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3b25414)
#34 0x000000000459470f 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
#35 0x000000000455a08d clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x455a08d)
#36 0x000000000455b17d 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+++0x455b17d)
#37 0x0000000004562aa5 clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4562aa5)
#38 0x0000000000cdfc39 clang_main(int, char**, llvm::ToolContext const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xcdfc39)
#39 0x0000000000badfd4 main (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xbadfd4)
#40 0x000075d3e9829d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#41 0x000075d3e9829e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#42 0x0000000000cda51e _start (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xcda51e)
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/eJzkWt9T4zgS_mvMiyopW_79wEMIZI8trqCA3X1MyXI70Y4j-SSZgfnrryQ7xDJJgDkytVU3xZBgS62vv_7UalsiSrEVBzj34gsvvjwjrV4Lef7C_iY8yqL4rBDly7mHZx6ePa6ZQhqUpkQBYgqtgIMkGkpUvCCCqvbHD5DTrrHnX3p-_3suNg2rQaKr56YWEqQXzpAXX6y1bpQXzjy88PBiJcpC1Hoq5MrDix8eXiQ0LuLg79_-8uJLD2cfb47z4fAWN-NPpGYloqIE9J3VNaKSqDUSH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