================
@@ -3045,13 +3051,20 @@ Sema::resolveAllocationArguments(LookupResult &R,
       *this, /*TypeIdentityArg=*/nullptr, AllocationSizeExpr,
       AllocationAlignmentExpr, /*IsMSVCCompatibilityFallback=*/false);
 
-  // C++17 [expr.new]p13:
-  //   If no matching function is found and the allocated object type has
-  //   new-extended alignment, the alignment argument is removed from the
-  //   argument list, and overload resolution is performed again.
+  // C++20 [expr.new]p18:
+  //   If no matching function is found then
+  //     — if the allocated object type has new-extended alignment, the
+  //       alignment argument is removed from the argument list;
+  //     — otherwise, an argument that is the type’s alignment and has type
+  //       std::align_val_t is added into the argument list immediately after
+  //       the first argument;
+  //   and then overload resolution is performed again.
   if (IAP.PassAlignment == AlignedAllocationMode::Yes)
     FoundArguments.push_back(AlignedArguments);
   FoundArguments.push_back(UnalignedArguments);
+  if (IAP.PassAlignment == AlignedAllocationMode::No &&
+      AllocationAlignmentExpr && getLangOpts().AlignedAllocation)
----------------
ojhunt wrote:

Are we getting here with a null `AllocationAlignmentExpr` while 
`getLangOpts().AlignedAllocation` is true? It could be hitting the existence of 
AlignedAllocationUnavailable which overrides aligned allocation (because of 
course)

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

Reply via email to