================
@@ -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:
Hmm, I think that's an error in the current code -- I wonder if it "works"
currently by happenstance. Let's leave that change out of your PR, just for
consistency. I'll work out a path to trip that and then correct both cases.
https://github.com/llvm/llvm-project/pull/215157
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits