================
@@ -12071,6 +12071,37 @@ NamespaceDecl *Sema::getOrCreateStdNamespace() {
   return getStdNamespace();
 }
 
+/// Check that the template-head of this class template is acceptable for
+/// a declaration of 'std::initializer_list', and optionally diagnose if
+/// it is not.
+/// \returns true if any issues were found.
+static bool CheckStdInitializerList(Sema &S, ClassTemplateDecl *Template,
+                                    bool Diagnose) {
+  TemplateParameterList *Params = Template->getTemplateParameters();
+  int ErrorKind = -1;
+
+  if (Params->size() != 1)
+    ErrorKind = 0; // must have exactly one template parameter
+  else if (Template->hasAssociatedConstraints())
+    ErrorKind = 1; // cannot have associated constraints
+  else {
+    auto *Param = dyn_cast<TemplateTypeParmDecl>(Params->getParam(0));
----------------
tbaederr wrote:

```suggestion
    const auto *Param = dyn_cast<TemplateTypeParmDecl>(Params->getParam(0));
```
I think the `Template` parameter can be const as well?

https://github.com/llvm/llvm-project/pull/133822
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to