[clang] [clang] Check `std::initializer_list` more strictly (PR #133822)

Timm Baeder via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 31 20:28:54 PDT 2025


================
@@ -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();
----------------
tbaederr wrote:

```suggestion
  const TemplateParameterList *Params = Template->getTemplateParameters();
```

https://github.com/llvm/llvm-project/pull/133822


More information about the cfe-commits mailing list