Skip to content

Commit 32916ae

Browse files
committed
Activate tests for new ADIOS2 schema on MSVC
This also fixes broken array placement new in MSVC
1 parent 80786d8 commit 32916ae

2 files changed

Lines changed: 11 additions & 9 deletions

File tree

src/IO/ADIOS/ADIOS2PreloadAttributes.cpp

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
#include "openPMD/IO/ADIOS/ADIOS2Auxiliary.hpp"
2929
#include "openPMD/auxiliary/StringManip.hpp"
3030

31+
#include <cstddef>
3132
#include <cstdlib>
3233
#include <iostream>
3334
#include <numeric>
@@ -52,7 +53,7 @@ namespace detail
5253
constexpr size_t
5354
operator()( Args &&... ) const
5455
{
55-
return 0;
56+
return alignof(std::max_align_t);
5657
}
5758
};
5859

@@ -102,7 +103,15 @@ namespace detail
102103
{
103104
numItems *= extent;
104105
}
105-
new( dest ) T[ numItems ]{};
106+
/*
107+
* MSVC does not like placement new of arrays, so we do it
108+
* in a loop instead.
109+
* https://developercommunity.visualstudio.com/t/c-placement-new-is-incorrectly-compiled/206439
110+
*/
111+
for( size_t i = 0; i < numItems; ++i )
112+
{
113+
new( dest + i ) T();
114+
}
106115
location.destroy = buffer;
107116
engine.Get( var, dest, adios2::Mode::Deferred );
108117
}

test/SerialIOTest.cpp

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3188,12 +3188,6 @@ TEST_CASE( "bp4_steps", "[serial][adios2]" )
31883188
}
31893189
}
31903190
)";
3191-
/*
3192-
* @todo Activate these tests for Windows as soon as we bump the required
3193-
* ADIOS2 version to 2.7.0. Read here:
3194-
* https://github.com/openPMD/openPMD-api/pull/813#issuecomment-762235260
3195-
*/
3196-
#ifndef _WIN32
31973191
// sing the yes no song
31983192
bp4_steps( "../samples/newlayout_bp4steps_yes_yes.bp", useSteps, useSteps );
31993193
bp4_steps(
@@ -3202,7 +3196,6 @@ TEST_CASE( "bp4_steps", "[serial][adios2]" )
32023196
"../samples/newlayout_bp4steps_yes_no.bp", useSteps, dontUseSteps );
32033197
bp4_steps(
32043198
"../samples/newlayout_bp4steps_no_no.bp", dontUseSteps, dontUseSteps );
3205-
#endif
32063199
}
32073200
#endif
32083201

0 commit comments

Comments
 (0)