[clang] [Clang] Implement P2747 constexpr placement new (PR #104586)
Vlad Serebrennikov via cfe-commits
cfe-commits at lists.llvm.org
Fri Aug 16 06:05:51 PDT 2024
================
@@ -10030,22 +10021,32 @@ bool PointerExprEvaluator::VisitCXXNewExpr(const CXXNewExpr *E) {
// (which should presumably be valid only if N is a multiple of
// alignof(int), and in any case can't be deallocated unless N is
// alignof(X) and X has new-extended alignment).
- if (E->getNumPlacementArgs() != 1 ||
- !E->getPlacementArg(0)->getType()->isNothrowT())
- return Error(E, diag::note_constexpr_new_placement);
-
LValue Nothrow;
if (!EvaluateLValue(E->getPlacementArg(0), Nothrow, Info))
return false;
IsNothrow = true;
+ } else if (OperatorNew->isReservedGlobalPlacementOperator()) {
+ if (!EvaluatePointer(E->getPlacementArg(0), Result, Info))
+ return false;
+ if (Result.Designator.Invalid)
+ return false;
+ /// if(!lifetimeStartedInEvaluation(Info, Result.getLValueBase()))
----------------
Endilll wrote:
Debugging leftovers?
https://github.com/llvm/llvm-project/pull/104586
More information about the cfe-commits
mailing list