================
@@ -2904,50 +2915,52 @@ static void DiagnoseAllocationLookupFailure(
auto Rerun = [&](ImplicitAllocationArguments &ArgumentList,
OverloadCandidateSet &Candidates,
SmallVectorImpl<Expr *> &Args) {
+ const LookupResult &LocalLookup =
+ ArgumentList.updateLookupForMSVCCompatibility(SemaRef, BaseLookup,
+ MSVCFallback);
llvm::append_range(Args, ArgumentList.getImplicitArguments());
llvm::append_range(Args, PlacementArguments);
FunctionDecl *Unused = nullptr;
- resolveAllocationOverload(SemaRef, R, Range, ArgumentList, Args, Unused,
- Candidates, /*Diagnose=*/false);
+ resolveAllocationOverload(SemaRef, LocalLookup, Range, ArgumentList, Args,
+ Unused, Candidates, /*Diagnose=*/false);
};
std::optional<OverloadCandidateSet> AlignedCandidates;
Expr *AlignArg = nullptr;
if (AlignedArgumentList) {
- AlignedCandidates.emplace(R.getNameLoc(),
OverloadCandidateSet::CSK_Normal);
+ AlignedCandidates.emplace(BaseLookup.getNameLoc(),
+ OverloadCandidateSet::CSK_Normal);
SmallVector<Expr *, 4> AlignedArgs;
Rerun(*AlignedArgumentList, *AlignedCandidates, AlignedArgs);
AlignArg = AlignedArgumentList->getAlignmentArgument();
}
- OverloadCandidateSet UnalignedCandidates(R.getNameLoc(),
+ OverloadCandidateSet UnalignedCandidates(BaseLookup.getNameLoc(),
OverloadCandidateSet::CSK_Normal);
SmallVector<Expr *, 4> UnalignedArgs;
Rerun(*UnalignedArgumentList, UnalignedCandidates, UnalignedArgs);
diagnoseNoViableFunctionForAllocationOverloadResolution(
- SemaRef, R, Range, UnalignedArgs, UnalignedCandidates,
- AlignedCandidates ? &*AlignedCandidates : nullptr, AlignArg);
+ SemaRef, BaseLookup, MSVCFallback, Range, UnalignedArgs,
+ UnalignedCandidates, AlignedCandidates ? &*AlignedCandidates : nullptr,
+ AlignArg);
}
-bool Sema::getTypeIdentityArgument(QualType Type, SourceLocation Loc,
- Expr **FoundExpr) {
+std::optional<Expr *> Sema::getTypeIdentityArgument(QualType Type,
+ SourceLocation Loc) {
auto [Slot, Inserted] =
AllocationTypeIdentityArguments.insert({Type, nullptr});
- if (!Inserted) {
- if (!Slot->second)
- return true;
- *FoundExpr = Slot->second;
- return false;
- }
- QualType TypeIdentity = tryBuildStdTypeIdentity(Type, SourceLocation());
- if (TypeIdentity.isNull())
- return false;
- if (RequireCompleteType(Loc, TypeIdentity, diag::err_incomplete_type))
- return true;
+ if (!Inserted)
+ return Slot->second;
+
+ QualType TypeIdentity = tryBuildStdTypeIdentity(Type, SourceLocation());
+ if (TypeIdentity.isNull() ||
+ RequireCompleteType(Loc, TypeIdentity, diag::err_incomplete_type)) {
+ AllocationTypeIdentityArguments.erase(Slot);
----------------
igorkudrin wrote:
Do I understand correctly that this `erase()` is only for
`RequireCompleteType()` to print the diagnostic again? If so, this requires a
comment.
https://github.com/llvm/llvm-project/pull/211482
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits