================
@@ -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)
----------------
igorkudrin wrote:

Updated. I'm not sure why this condition is needed, given that it's missing 
when IAP is filled: 
https://github.com/igorkudrin/llvm-project/blob/b32d522cc625b8573b9887c9177b84f8052a4f37/clang/lib/Sema/SemaExprCXX.cpp#L2446-L2449

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