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

via cfe-commits cfe-commits at lists.llvm.org
Wed Apr 9 11:11:44 PDT 2025


================
@@ -12155,16 +12185,16 @@ static ClassTemplateDecl *LookupStdInitializerList(Sema &S, SourceLocation Loc){
     Result.suppressDiagnostics();
     // We found something weird. Complain about the first thing we found.
     NamedDecl *Found = *Result.begin();
-    S.Diag(Found->getLocation(), diag::err_malformed_std_initializer_list);
+    S.Diag(Found->getLocation(), diag::err_malformed_std_initializer_list)
+        << diag::MalformedStdInitializerList::BadEntityKind;
+    S.Diag(Loc, diag::note_used_here);
     return nullptr;
----------------
offsetof wrote:

It currently takes a `ClassTemplateDecl`, but here `Found` is some other kind of declaration


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


More information about the cfe-commits mailing list