Skip to content

Commit 312f258

Browse files
committed
Runtime: correct invalid C++ workaround
The placement new operator is only available when `<new>` has been included. Add the missing include to the header to allow us to get the definition of the placement new allocator. This allows us to remove the workaround that was there for Windows, and should hopefully repair the Android build as well. Thanks to @grynspan for helping identify the underlying issue!
1 parent a79ea9d commit 312f258

File tree

2 files changed

+1
-8
lines changed

2 files changed

+1
-8
lines changed

include/swift/Runtime/Atomic.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -95,14 +95,6 @@ struct aligned_alloc<Alignment_, true> {
9595
free(ptr);
9696
#endif
9797
}
98-
99-
#if defined(_WIN32)
100-
// FIXME: why is this even needed? This is not permitted as per the C++
101-
// standrd new.delete.placement (§17.6.3.4).
102-
[[nodiscard]] void *operator new(std::size_t size, void *where) noexcept {
103-
return ::operator new(size, where);
104-
}
105-
#endif
10698
};
10799

108100
/// The default implementation for swift::atomic<T>, which just wraps

stdlib/public/runtime/MetadataImpl.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
#include "EnumImpl.h"
5252

5353
#include <cstring>
54+
#include <new>
5455
#include <type_traits>
5556

5657
namespace swift {

0 commit comments

Comments
 (0)