From e6c7e1cb4d03aa117675622927a5be94c007d110 Mon Sep 17 00:00:00 2001 From: Axel Huebl Date: Tue, 14 Sep 2021 17:17:46 -0700 Subject: [PATCH 1/2] NVCC + C++17 Work-around a build issue with NVCC in C++17 builds. ``` include/openPMD/backend/Attributable.hpp(437): error #289: no instance of constructor "openPMD::Attribute::Attribute" matches the argument list argument types are: (std::__cxx11::string) detected during instantiation of "__nv_bool openPMD::AttributableInterface::setAttribute(const std::__cxx11::string &, T) [with T=std::__cxx11::string]" ``` from ``` inline bool AttributableInterface::setAttribute( std::string const & key, char const value[] ) { return this->setAttribute(key, std::string(value)); } ``` Seen with: - NVCC 11.0.2 + GCC 8.3.0 - NVCC 11.0.2 + GCC 7.5.0 --- include/openPMD/backend/Attributable.hpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/openPMD/backend/Attributable.hpp b/include/openPMD/backend/Attributable.hpp index a1e0c05a95..8ec131be8b 100644 --- a/include/openPMD/backend/Attributable.hpp +++ b/include/openPMD/backend/Attributable.hpp @@ -434,7 +434,8 @@ AttributableInterface::setAttribute( std::string const & key, T value ) && !attri.m_attributes.key_comp()(key, it->first) ) { // key already exists in map, just replace the value - it->second = Attribute(value); + Attribute::resource val(value); + it->second = Attribute(std::move(val)); return true; } else { From 284512c440719eaf7ee2bca6256efa3017328b7d Mon Sep 17 00:00:00 2001 From: Axel Huebl Date: Wed, 15 Sep 2021 16:14:03 -0700 Subject: [PATCH 2/2] NVCC 11.0.2 C++17 work-around: Add Comment --- include/openPMD/backend/Attributable.hpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/include/openPMD/backend/Attributable.hpp b/include/openPMD/backend/Attributable.hpp index 8ec131be8b..157d732345 100644 --- a/include/openPMD/backend/Attributable.hpp +++ b/include/openPMD/backend/Attributable.hpp @@ -434,8 +434,12 @@ AttributableInterface::setAttribute( std::string const & key, T value ) && !attri.m_attributes.key_comp()(key, it->first) ) { // key already exists in map, just replace the value - Attribute::resource val(value); - it->second = Attribute(std::move(val)); + + // note: due to a C++17 issue with NVCC 11.0.2 we write the + // T value to variant conversion explicitly + // https://github.com/openPMD/openPMD-api/pull/1103 + //it->second = Attribute(std::move(value)); + it->second = Attribute(Attribute::resource(std::move(value))); return true; } else {