================
@@ -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());
----------------
igorkudrin wrote:
> CWG2282 was accepted as a DR. Is there anything preventing us from
> backporting this to earlier language modes?
The wording was changed in the C++20 Standard. If we were to change the
behaviour for C++17, this would contradict the corresponding document. However,
I don't have a strong preference here and will leave the decision to the
maintainers.
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