diff --git a/lib/IRGen/GenExistential.cpp b/lib/IRGen/GenExistential.cpp index 5e0d4af15359d..8f5699184c495 100644 --- a/lib/IRGen/GenExistential.cpp +++ b/lib/IRGen/GenExistential.cpp @@ -168,7 +168,11 @@ namespace { const size_t count = pThis->NumStoredProtocols; const size_t size = Tail::template totalSizeToAlloc(count); +#if defined(__cpp_sized_deallocation) && __cpp_sized_deallocation >= 201309L ::operator delete(ptr, size); +#else + ::operator delete(ptr); +#endif } /// Returns the number of protocol witness tables directly carried diff --git a/lib/IRGen/GenRecord.h b/lib/IRGen/GenRecord.h index 65acff49edccf..0416cca7dd858 100644 --- a/lib/IRGen/GenRecord.h +++ b/lib/IRGen/GenRecord.h @@ -161,7 +161,11 @@ class RecordTypeInfoImpl : public Base, const auto *pThis = static_cast(ptr); const size_t count = pThis->NumFields; const size_t size = Impl::template totalSizeToAlloc(count); +#if defined(__cpp_sized_deallocation) && __cpp_sized_deallocation >= 201309L ::operator delete(ptr, size); +#else + ::operator delete(ptr); +#endif } bool areFieldsABIAccessible() const { diff --git a/lib/IRGen/ProtocolInfo.h b/lib/IRGen/ProtocolInfo.h index 8c4180cb549c1..88d3b8199945f 100644 --- a/lib/IRGen/ProtocolInfo.h +++ b/lib/IRGen/ProtocolInfo.h @@ -234,7 +234,11 @@ class ProtocolInfo final : const auto *pThis = static_cast(ptr); const size_t count = pThis->NumTableEntries; const size_t size = totalSizeToAlloc(count); +#if defined(__cpp_sized_deallocation) && __cpp_sized_deallocation >= 201309L ::operator delete(ptr, size); +#else + ::operator delete(ptr); +#endif } /// The number of witness slots in a conformance to this protocol;