<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/65117>65117</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Assertion `!Unexpanded.empty() && "Unable to find unexpanded parameter packs" (no lambdas)
</td>
</tr>
<tr>
<th>Labels</th>
<td>
c++11,
clang:frontend,
crash-on-invalid
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
Endilll
</td>
</tr>
</table>
<pre>
While reducing test case in #35603 (`<tuple>` header), I stumbled upon a different crash in trunk (https://godbolt.org/z/39ncPKnGq):
```cpp
template <typename>
struct __tuple_leaf {
int a;
};
template <typename... _Tp>
struct __tuple_impl : __tuple_leaf<_Tp>... {
constexpr __tuple_impl(_Tp... __u)
: __tuple_leaf<int>(__u)... {}
};
__tuple_impl<> a{};
```
```
<source>:9:31: error: pack expansion does not contain any unexpanded parameter packs
9 | : __tuple_leaf<int>(__u)... {}
| ~~~~~~~~~~~~~~~~~~~~~~^
clang++: /root/llvm-project/clang/lib/Sema/SemaTemplateVariadic.cpp:407:
bool clang::Sema::DiagnoseUnexpandedParameterPack(clang::Expr*, clang::Sema::UnexpandedParameterPackContext):
Assertion `!Unexpanded.empty() && "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 -S --gcc-toolchain=/opt/compiler-explorer/gcc-snapshot -fcolor-diagnostics -fno-crash-diagnostics -std=c++11 <source>
1. <source>:12:19: current parser token ';'
2. <source>:8:13: instantiating function definition '__tuple_impl<>::__tuple_impl'
#0 0x00000000036aaf18 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x36aaf18)
#1 0x00000000036a8bdc llvm::sys::CleanupOnSignal(unsigned long) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x36a8bdc)
#2 0x00000000035f43e8 CrashRecoverySignalHandler(int) CrashRecoveryContext.cpp:0:0
#3 0x00007f3e0fdec420 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x14420)
#4 0x00007f3e0f8af00b raise (/lib/x86_64-linux-gnu/libc.so.6+0x4300b)
#5 0x00007f3e0f88e859 abort (/lib/x86_64-linux-gnu/libc.so.6+0x22859)
#6 0x00007f3e0f88e729 (/lib/x86_64-linux-gnu/libc.so.6+0x22729)
#7 0x00007f3e0f89ffd6 (/lib/x86_64-linux-gnu/libc.so.6+0x33fd6)
#8 0x00000000069c03ed (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x69c03ed)
#9 0x0000000006211442 clang::Sema::BuildBaseInitializer(clang::QualType, clang::TypeSourceInfo*, clang::Expr*, clang::CXXRecordDecl*, clang::SourceLocation) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6211442)
#10 0x000000000699b590 clang::Sema::InstantiateMemInitializers(clang::CXXConstructorDecl*, clang::CXXConstructorDecl const*, clang::MultiLevelTemplateArgumentList const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x699b590)
#11 0x00000000069a14be clang::Sema::InstantiateFunctionDefinition(clang::SourceLocation, clang::FunctionDecl*, bool, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x69a14be)
#12 0x0000000006388f19 void llvm::function_ref<void ()>::callback_fn<clang::Sema::MarkFunctionReferenced(clang::SourceLocation, clang::FunctionDecl*, bool)::'lambda'()>(long) SemaExpr.cpp:0:0
#13 0x0000000005f58e91 clang::Sema::runWithSufficientStackSpace(clang::SourceLocation, llvm::function_ref<void ()>) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x5f58e91)
#14 0x0000000006380024 clang::Sema::MarkFunctionReferenced(clang::SourceLocation, clang::FunctionDecl*, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6380024)
#15 0x00000000061fca54 clang::Sema::BuildCXXConstructExpr(clang::SourceLocation, clang::QualType, clang::CXXConstructorDecl*, bool, llvm::MutableArrayRef<clang::Expr*>, bool, bool, bool, bool, unsigned int, clang::SourceRange) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x61fca54)
#16 0x0000000006293594 clang::Sema::BuildCXXConstructExpr(clang::SourceLocation, clang::QualType, clang::NamedDecl*, clang::CXXConstructorDecl*, llvm::MutableArrayRef<clang::Expr*>, bool, bool, bool, bool, unsigned int, clang::SourceRange) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6293594)
#17 0x0000000006543ed6 PerformConstructorInitialization(clang::Sema&, clang::InitializedEntity const&, clang::InitializationKind const&, llvm::MutableArrayRef<clang::Expr*>, clang::InitializationSequence::Step const&, bool&, bool, bool, clang::SourceLocation, clang::SourceLocation) SemaInit.cpp:0:0
#18 0x0000000006557ecc clang::InitializationSequence::Perform(clang::Sema&, clang::InitializedEntity const&, clang::InitializationKind const&, llvm::MutableArrayRef<clang::Expr*>, clang::QualType*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6557ecc)
#19 0x000000000616c8bb clang::Sema::AddInitializerToDecl(clang::Decl*, clang::Expr*, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x616c8bb)
#20 0x0000000005e2fdb2 clang::Parser::ParseDeclarationAfterDeclaratorAndAttributes(clang::Declarator&, clang::Parser::ParsedTemplateInfo const&, clang::Parser::ForRangeInit*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x5e2fdb2)
#21 0x0000000005e3db30 clang::Parser::ParseDeclGroup(clang::ParsingDeclSpec&, clang::DeclaratorContext, clang::ParsedAttributes&, clang::SourceLocation*, clang::Parser::ForRangeInit*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x5e3db30)
#22 0x0000000005e0ab6b clang::Parser::ParseDeclOrFunctionDefInternal(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec&, clang::AccessSpecifier) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x5e0ab6b)
#23 0x0000000005e0b29f clang::Parser::ParseDeclarationOrFunctionDefinition(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*, clang::AccessSpecifier) (.part.0) Parser.cpp:0:0
#24 0x0000000005e119b4 clang::Parser::ParseExternalDeclaration(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x5e119b4)
#25 0x0000000005e121bd clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, clang::Sema::ModuleImportState&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x5e121bd)
#26 0x0000000005e0651a clang::ParseAST(clang::Sema&, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x5e0651a)
#27 0x0000000004911678 clang::CodeGenAction::ExecuteAction() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4911678)
#28 0x00000000041733f9 clang::FrontendAction::Execute() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x41733f9)
#29 0x00000000040f5e8e clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x40f5e8e)
#30 0x0000000004253a46 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4253a46)
#31 0x0000000000bd16e7 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xbd16e7)
#32 0x0000000000bc9d9a ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&) driver.cpp:0:0
#33 0x0000000003f566e9 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
#34 0x00000000035f4894 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x35f4894)
#35 0x0000000003f56cdf 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
#36 0x0000000003f1f445 clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3f1f445)
#37 0x0000000003f1fead 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+++0x3f1fead)
#38 0x0000000003f27d35 clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3f27d35)
#39 0x0000000000bcf97c clang_main(int, char**, llvm::ToolContext const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xbcf97c)
#40 0x0000000000acc7c1 main (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xacc7c1)
#41 0x00007f3e0f890083 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x24083)
#42 0x0000000000bc987e _start (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xbc987e)
clang++: error: clang frontend command failed with exit code 134 (use -v to see invocation)
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzkWt9z46iT_2uUF8ouCfTzIQ8eJ9mb_c7c5ibZ3XlzIdFyuJFBCyjr7MP97Vcg2Ra2nM3sx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