[clang] [Clang] Implement CWG 2282 (PR #215157)

Oliver Hunt via cfe-commits cfe-commits at lists.llvm.org
Sun Aug 9 16:07:37 PDT 2026


================
@@ -2896,17 +2899,20 @@ DiagnoseAllocationLookupFailure(Sema &SemaRef, const LookupResult &R,
   ImplicitAllocationArguments *UnalignedArgumentList = nullptr;
   ImplicitAllocationArguments *AlignedArgumentList = nullptr;
   bool IncludedMSVCFallback = false;
+  bool AlignedBeforeUnaligned = true;
   for (ImplicitAllocationArguments &AllocationArguments : ArgumentCandidates) {
     if (AllocationArguments.IsMSVCCompatibilityFallback) {
       IncludedMSVCFallback = true;
       continue;
     }
     if (AllocationArguments.PassTypeIdentity == TypeAwareAllocationMode::Yes)
       continue;
-    if (AllocationArguments.PassAlignment == AlignedAllocationMode::Yes)
+    if (AllocationArguments.PassAlignment == AlignedAllocationMode::Yes) {
       AlignedArgumentList = &AllocationArguments;
-    else
+      AlignedBeforeUnaligned = !UnalignedArgumentList;
+    } else {
       UnalignedArgumentList = &AllocationArguments;
+    }
----------------
ojhunt wrote:

~~Why is this needed?~~ 

Oh ugh, we don't pass the candidate selector information to diagnosis just the parameter lists. Will deal with this when I re-work the diagnostics.

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


More information about the cfe-commits mailing list