Skip to content

Commit 3b0f40b

Browse files
committed
Activate tests for new ADIOS2 schema on MSVC
This also fixes broken array placement new in MSVC
1 parent 5de0b20 commit 3b0f40b

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
@@ -3235,12 +3235,6 @@ TEST_CASE( "bp4_steps", "[serial][adios2]" )
32353235
}
32363236
}
32373237
)";
3238-
/*
3239-
* @todo Activate these tests for Windows as soon as we bump the required
3240-
* ADIOS2 version to 2.7.0. Read here:
3241-
* https://github.com/openPMD/openPMD-api/pull/813#issuecomment-762235260
3242-
*/
3243-
#ifndef _WIN32
32443238
// sing the yes no song
32453239
bp4_steps( "../samples/newlayout_bp4steps_yes_yes.bp", useSteps, useSteps );
32463240
bp4_steps(
@@ -3249,7 +3243,6 @@ TEST_CASE( "bp4_steps", "[serial][adios2]" )
32493243
"../samples/newlayout_bp4steps_yes_no.bp", useSteps, dontUseSteps );
32503244
bp4_steps(
32513245
"../samples/newlayout_bp4steps_no_no.bp", dontUseSteps, dontUseSteps );
3252-
#endif
32533246
}
32543247
#endif
32553248

0 commit comments

Comments
 (0)