Skip to content

Commit ce0f071

Browse files
authored
Work-Around: libc++ shared_ptr array (#1409)
This is an issue fixed in LLVM libc++ 11+. https://godbolt.org/z/8fT4TYrdj
1 parent 47af576 commit ce0f071

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

include/openPMD/RecordComponent.tpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ inline std::shared_ptr< T > RecordComponent::loadChunk(
8383
for( auto const& dimensionSize : extent )
8484
numPoints *= dimensionSize;
8585

86-
#if (defined(__clang_major__) && __clang_major__ < 7) || \
86+
#if (defined(_LIBCPP_VERSION) && _LIBCPP_VERSION < 11000) || \
8787
(defined(__apple_build_version__) && __clang_major__ < 14)
8888
auto newData =
8989
std::shared_ptr<T>(new T[numPoints], [](T *p) { delete[] p; });
@@ -378,7 +378,7 @@ RecordComponent::storeChunk( Offset offset, Extent extent )
378378
std::move( extent ),
379379
[]( size_t size )
380380
{
381-
#if (defined(__clang_major__) && __clang_major__ < 7) || \
381+
#if (defined(_LIBCPP_VERSION) && _LIBCPP_VERSION < 11000) || \
382382
(defined(__apple_build_version__) && __clang_major__ < 14)
383383
return std::shared_ptr< T >{
384384
new T[ size ], []( auto * ptr ) { delete[] ptr; } };

include/openPMD/backend/PatchRecordComponent.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ template <typename T>
145145
inline std::shared_ptr<T> PatchRecordComponent::load()
146146
{
147147
uint64_t numPoints = getExtent()[0];
148-
#if (defined(__clang_major__) && __clang_major__ < 7) || \
148+
#if (defined(_LIBCPP_VERSION) && _LIBCPP_VERSION < 11000) || \
149149
(defined(__apple_build_version__) && __clang_major__ < 14)
150150
auto newData =
151151
std::shared_ptr<T>(new T[numPoints], [](T *p) { delete[] p; });

0 commit comments

Comments
 (0)