================
@@ -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:
Oh sorry, this was me having a brain fart -- I think this should also have the
`&& !getLangOpts().AlignedAllocationUnavailable` (yes this is terrible, and
afaict is an artifact of how the driver works)
https://github.com/llvm/llvm-project/pull/215157
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits