[clang] [clang-tools-extra] [Clang] Add a builtin that deduplicate types into a pack (PR #106730)
Ilya Biryukov via cfe-commits
cfe-commits at lists.llvm.org
Mon Aug 11 10:47:38 PDT 2025
================
@@ -777,12 +844,32 @@ bool Sema::CheckParameterPacksForExpansion(
IdentifierInfo *Name;
bool IsVarDeclPack = false;
FunctionParmPackExpr *BindingPack = nullptr;
+ std::optional<unsigned> NumPrecomputedArguments;
- if (const TemplateTypeParmType *TTP =
- ParmPack.first.dyn_cast<const TemplateTypeParmType *>()) {
+ if (auto *TTP = ParmPack.first.dyn_cast<const TemplateTypeParmType *>()) {
Depth = TTP->getDepth();
Index = TTP->getIndex();
Name = TTP->getIdentifier();
+ } else if (auto *TST =
+ ParmPack.first
+ .dyn_cast<const TemplateSpecializationType *>()) {
+ assert(isPackProducingBuiltinTemplateName(TST->getTemplateName()));
+ // Delay expansion, substitution is required to know the size.
+ ShouldExpand = false;
+ if (!FailOnPackProducingTemplates)
+ continue;
+
+ // It is not yet supported in many positions.
+ Diag(PatternRange.getBegin().isValid() ? PatternRange.getBegin()
+ : EllipsisLoc,
+ diag::err_unsupported_builtin_template_pack_position)
+ << TST->getTemplateName();
+ return true;
----------------
ilya-biryukov wrote:
Done.
https://github.com/llvm/llvm-project/pull/106730
More information about the cfe-commits
mailing list