Skip to content

Clang assertion failure: "Unable to find unexpanded parameter packs" #112352

@zmodem

Description

@zmodem

We hit this in some new code, so it may not be a Clang regression:

Preprocessed source: a.ii.gz

$ build/bin/clang -cc1 -triple x86_64-unknown-linux-gnu -fsyntax-only -std=c++20 /tmp/a.ii -w
clang: /work/llvm-project/clang/lib/Sema/SemaTemplateVariadic.cpp:456: bool clang::Sema::DiagnoseUnexpandedParameterPack(Expr *, UnexpandedParameterPackContext): Assertion `(!Unexpanded.empty() || Visitor.containsFunctionParmPackExpr()) && "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: build/bin/clang -cc1 -triple x86_64-unknown-linux-gnu -fsyntax-only -std=c++20 /tmp/a.ii -w
1.      <eof> parser at end of file
2.      ../../remoting/host/linux/gvariant_ref.h:709:22: instantiating function definition 'remoting::gvariant::GVariantRef<Type<20UL - 1>{{}, {"(ii{s((xt)(xt))}uv)"}}>::Destructure<int &, int &, std::tuple<std::string &, std::tuple<std::tuple<long &, unsigned long &> &&, std::tuple<long &, unsigned long &> &&> &&>, unsigned int &, std::tuple<remoting::gvariant::GVariantRef<> &>>'
 #0 0x000055cb15dfdc88 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (build/bin/clang+0x3b7fc88)
 #1 0x000055cb15dfb83e llvm::sys::RunSignalHandlers() (build/bin/clang+0x3b7d83e)
 #2 0x000055cb15dfe318 SignalHandler(int) Signals.cpp:0:0
 #3 0x00007f8570e591a0 (/lib/x86_64-linux-gnu/libc.so.6+0x3d1a0)
 #4 0x00007f8570ea70ec __pthread_kill_implementation ./nptl/pthread_kill.c:44:76
 #5 0x00007f8570e59102 gsignal ./signal/../sysdeps/posix/raise.c:27:6
 #6 0x00007f8570e424f2 abort ./stdlib/abort.c:81:7
 #7 0x00007f8570e42415 _nl_load_domain ./intl/loadmsgcat.c:1177:9
 #8 0x00007f8570e51d32 (/lib/x86_64-linux-gnu/libc.so.6+0x35d32)
 #9 0x000055cb18e057ea (build/bin/clang+0x6b877ea)
#10 0x000055cb18778d7c clang::Sema::ActOnFinishFullExpr(clang::Expr*, clang::SourceLocation, bool, bool, bool) (build/bin/clang+0x64fad7c)
#11 0x000055cb1862032a clang::Sema::ActOnCondition(clang::Scope*, clang::SourceLocation, clang::Expr*, clang::Sema::ConditionKind, bool) (build/bin/clang+0x63a232a)
#12 0x000055cb18d93221 clang::TreeTransform<(anonymous namespace)::TemplateInstantiator>::TransformCondition(clang::SourceLocation, clang::VarDecl*, clang::Expr*, clang::Sema::ConditionKind) SemaTemplateInstantiate.cpp:0:0
#13 0x000055cb18d90126 clang::TreeTransform<(anonymous namespace)::TemplateInstantiator>::TransformIfStmt(clang::IfStmt*) SemaTemplateInstantiate.cpp:0:0
#14 0x000055cb18d721e2 clang::TreeTransform<(anonymous namespace)::TemplateInstantiator>::TransformCompoundStmt(clang::CompoundStmt*, bool) SemaTemplateInstantiate.cpp:0:0
#15 0x000055cb18d78b30 clang::TreeTransform<(anonymous namespace)::TemplateInstantiator>::TransformLambdaExpr(clang::LambdaExpr*) SemaTemplateInstantiate.cpp:0:0
#16 0x000055cb18d685e8 (anonymous namespace)::TemplateInstantiator::TransformLambdaExpr(clang::LambdaExpr*) SemaTemplateInstantiate.cpp:0:0
#17 0x000055cb18d6b0f5 clang::TreeTransform<(anonymous namespace)::TemplateInstantiator>::TransformCallExpr(clang::CallExpr*) SemaTemplateInstantiate.cpp:0:0
#18 0x000055cb18d6dcd5 clang::TreeTransform<(anonymous namespace)::TemplateInstantiator>::TransformCXXFoldExpr(clang::CXXFoldExpr*) SemaTemplateInstantiate.cpp:0:0
#19 0x000055cb18cf7ec5 clang::TreeTransform<(anonymous namespace)::TemplateInstantiator>::TransformStmt(clang::Stmt*, clang::TreeTransform<(anonymous namespace)::TemplateInstantiator>::StmtDiscardKind) SemaTemplateInstantiate.cpp:0:0
#20 0x000055cb18d721e2 clang::TreeTransform<(anonymous namespace)::TemplateInstantiator>::TransformCompoundStmt(clang::CompoundStmt*, bool) SemaTemplateInstantiate.cpp:0:0
#21 0x000055cb18d78b30 clang::TreeTransform<(anonymous namespace)::TemplateInstantiator>::TransformLambdaExpr(clang::LambdaExpr*) SemaTemplateInstantiate.cpp:0:0
#22 0x000055cb18d685e8 (anonymous namespace)::TemplateInstantiator::TransformLambdaExpr(clang::LambdaExpr*) SemaTemplateInstantiate.cpp:0:0
#23 0x000055cb18d6b0f5 clang::TreeTransform<(anonymous namespace)::TemplateInstantiator>::TransformCallExpr(clang::CallExpr*) SemaTemplateInstantiate.cpp:0:0
#24 0x000055cb18cf7ec5 clang::TreeTransform<(anonymous namespace)::TemplateInstantiator>::TransformStmt(clang::Stmt*, clang::TreeTransform<(anonymous namespace)::TemplateInstantiator>::StmtDiscardKind) SemaTemplateInstantiate.cpp:0:0
#25 0x000055cb18d721e2 clang::TreeTransform<(anonymous namespace)::TemplateInstantiator>::TransformCompoundStmt(clang::CompoundStmt*, bool) SemaTemplateInstantiate.cpp:0:0
#26 0x000055cb18cf7e5a clang::Sema::SubstStmt(clang::Stmt*, clang::MultiLevelTemplateArgumentList const&) (build/bin/clang+0x6a79e5a)
#27 0x000055cb18dc1022 clang::Sema::InstantiateFunctionDefinition(clang::SourceLocation, clang::FunctionDecl*, bool, bool, bool) (build/bin/clang+0x6b43022)
#28 0x000055cb18dc40ee clang::Sema::PerformPendingInstantiations(bool) (build/bin/clang+0x6b460ee)
#29 0x000055cb182b992d clang::Sema::ActOnEndOfTranslationUnitFragment(clang::Sema::TUFragmentKind) (build/bin/clang+0x603b92d)
#30 0x000055cb182ba0ac clang::Sema::ActOnEndOfTranslationUnit() (build/bin/clang+0x603c0ac)
#31 0x000055cb18171bee clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, clang::Sema::ModuleImportState&) (build/bin/clang+0x5ef3bee)
#32 0x000055cb1816dfee clang::ParseAST(clang::Sema&, bool, bool) (build/bin/clang+0x5eeffee)
#33 0x000055cb1685d17f clang::FrontendAction::Execute() (build/bin/clang+0x45df17f)
#34 0x000055cb167ceacd clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (build/bin/clang+0x4550acd)
#35 0x000055cb1693c747 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (build/bin/clang+0x46be747)
#36 0x000055cb1363f56e cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (build/bin/clang+0x13c156e)
#37 0x000055cb1363bb8e ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&) driver.cpp:0:0
#38 0x000055cb1363abad clang_main(int, char**, llvm::ToolContext const&) (build/bin/clang+0x13bcbad)
#39 0x000055cb1364ace7 main (build/bin/clang+0x13ccce7)
#40 0x00007f8570e43b8a __libc_start_call_main ./csu/../sysdeps/nptl/libc_start_call_main.h:74:3
#41 0x00007f8570e43c45 call_init ./csu/../csu/libc-start.c:128:20
#42 0x00007f8570e43c45 __libc_start_main ./csu/../csu/libc-start.c:347:5
#43 0x000055cb13639761 _start (build/bin/clang+0x13bb761)
Aborted

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions