Skip to content

Commit 540ecc8

Browse files
committed
ICC 19.1.2: CXX17 Work-Arounds (Variant)
The `Attribute` constructors with implicit variant conversion sometimes do not work in ICC 19.1.2. ``` openPMD-api/src/RecordComponent.cpp(226): error: no instance of constructor "openPMD::Attribute::Attribute" matches the argument list argument types are: (openPMD::Extent) Attribute a(getExtent()); ^ openPMD-api/include/openPMD/backend/Attribute.hpp(50): note: this candidate was rejected because arguments do not match class Attribute : ^ openPMD-api/include/openPMD/backend/Attribute.hpp(50): note: this candidate was rejected because arguments do not match class Attribute : ^ openPMD-api/include/openPMD/backend/Attribute.hpp(79): note: this candidate was rejected because arguments do not match Attribute(resource r) : Variant(std::move(r)) ^ ``` Same work-around as for NVCC in openPMD#1103
1 parent 680a011 commit 540ecc8

3 files changed

Lines changed: 16 additions & 3 deletions

File tree

src/IO/HDF5/HDF5IOHandler.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,12 @@ HDF5IOHandlerImpl::createDataset(Writable* writable,
346346
std::cerr << "[HDF5] Datatype::UNDEFINED caught during dataset creation (serial HDF5)" << std::endl;
347347
d = Datatype::BOOL;
348348
}
349-
Attribute a(0);
349+
350+
// note: due to a C++17 issue with ICC 19.1.2 we write the
351+
// T value to variant conversion explicitly
352+
// https://github.com/openPMD/openPMD-api/pull/...
353+
// Attribute a(0);
354+
Attribute a(static_cast<Attribute::resource>(0));
350355
a.dtype = d;
351356
std::vector< hsize_t > dims;
352357
std::uint64_t num_elements = 1u;

src/RecordComponent.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,11 @@ RecordComponent::flush(std::string const& name)
223223
aWrite.resource = m_constantValue->getResource();
224224
IOHandler()->enqueue(IOTask(this, aWrite));
225225
aWrite.name = "shape";
226-
Attribute a(getExtent());
226+
// note: due to a C++17 issue with ICC 19.1.2 we write the
227+
// T value to variant conversion explicitly
228+
// https://github.com/openPMD/openPMD-api/pull/...
229+
// Attribute a(getExtent());
230+
Attribute a(static_cast<Attribute::resource>(getExtent()));
227231
aWrite.dtype = a.dtype;
228232
aWrite.resource = a.getResource();
229233
IOHandler()->enqueue(IOTask(this, aWrite));

test/CoreTest.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,11 @@ TEST_CASE( "versions_test", "[core]" )
3737

3838
TEST_CASE( "attribute_dtype_test", "[core]" )
3939
{
40-
Attribute a = Attribute(static_cast< char >(' '));
40+
// note: due to a C++17 issue with ICC 19.1.2 we write the
41+
// T value to variant conversion explicitly
42+
// https://github.com/openPMD/openPMD-api/pull/...
43+
// Attribute a = Attribute(static_cast< char >(' '));
44+
Attribute a = Attribute(static_cast<Attribute::resource>(static_cast< char >(' ')));
4145
REQUIRE(Datatype::CHAR == a.dtype);
4246
a = Attribute(static_cast< unsigned char >(' '));
4347
REQUIRE(Datatype::UCHAR == a.dtype);

0 commit comments

Comments
 (0)