Skip to content

Commit 1bcaff4

Browse files
committed
Fix type comparison for Windows
1 parent 579e063 commit 1bcaff4

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

include/openPMD/backend/PatchRecordComponent.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,8 @@ template <typename T>
122122
inline void PatchRecordComponent::load(std::shared_ptr<T> data)
123123
{
124124
Datatype dtype = determineDatatype<T>();
125-
if (dtype != getDatatype())
125+
// Attention: Do NOT use operator==(), doesnt work properly on Windows!
126+
if (!isSame(dtype, getDatatype()))
126127
throw std::runtime_error(
127128
"Type conversion during particle patch loading not yet "
128129
"implemented");

src/RecordComponent.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -833,8 +833,10 @@ void RecordComponent::loadChunk(std::shared_ptr<T> data, Offset o, Extent e)
833833
* JSON/TOML backends as they might implicitly turn a LONG into an INT in a
834834
* constant component. The frontend needs to catch such edge cases.
835835
* Ref. `if (constant())` branch.
836+
*
837+
* Attention: Do NOT use operator==(), doesnt work properly on Windows!
836838
*/
837-
if (dtype != getDatatype() && !constant())
839+
if (!isSame(dtype, getDatatype()) && !constant())
838840
{
839841
std::string const data_type_str = datatypeToString(getDatatype());
840842
std::string const requ_type_str =

0 commit comments

Comments
 (0)