================
@@ -3406,25 +3406,39 @@ static QualType checkBuiltinTemplateIdType(
     Sema &SemaRef, ElaboratedTypeKeyword Keyword, BuiltinTemplateDecl *BTD,
     ArrayRef<TemplateArgument> Converted, SourceLocation TemplateLoc,
     TemplateArgumentListInfo &TemplateArgs) {
+  TemplateParameterList *Params = BTD->getTemplateParameters();
+  unsigned RequiredArgs = Params->size();
+  if (Params->hasParameterPack()) {
+    if (Converted.size() < RequiredArgs)
+      return QualType();
+  } else {
+    if (Converted.size() != RequiredArgs)
+      return QualType();
+  }
----------------
mizvekov wrote:

Sorry for not responding earlier.

A template argument list can contain a pack argument, which is another list 
with a fixed size.
So a list with with this structure: "(1, (1, 2, 3))" has size four, instead of 
two. I don't think at the moment a template argument pack can itself contain 
another pack.

Also, a template argument can be a pack expansion. A pack expansion can have 
known size, in which case you just account for that size, or it can have 
unknown size, which is at minimum 0, with no maximum, so for these lists you 
can only know the minimum size.

https://github.com/llvm/llvm-project/pull/180407
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to