================
@@ -3043,11 +3056,23 @@ bool Sema::FindAllocationFunctions(
       //   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.
+      bool UseFallback = isAlignedAllocation(OriginalAlignedAllocationMode) ||
+                         (getLangOpts().CPlusPlus20 && getStdAlignValT());
----------------
cor3ntin wrote:

Yes, this should be applied in all language modes

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

Reply via email to