From b69713c39480a4aa0b05b24ea07cc542219012ff Mon Sep 17 00:00:00 2001 From: Niels Lohmann Date: Sun, 2 Jan 2022 09:03:56 +0100 Subject: [PATCH] Fix compilation error with NVCC (#3234) --- include/nlohmann/ordered_map.hpp | 8 ++++---- single_include/nlohmann/json.hpp | 8 ++++---- test/cuda_example/json_cuda.cu | 4 ++++ 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/include/nlohmann/ordered_map.hpp b/include/nlohmann/ordered_map.hpp index 51b954524..bfcf89a40 100644 --- a/include/nlohmann/ordered_map.hpp +++ b/include/nlohmann/ordered_map.hpp @@ -23,10 +23,10 @@ template , using key_type = Key; using mapped_type = T; using Container = std::vector, Allocator>; - using typename Container::iterator; - using typename Container::const_iterator; - using typename Container::size_type; - using typename Container::value_type; + using iterator = typename Container::iterator; + using const_iterator = typename Container::const_iterator; + using size_type = typename Container::size_type; + using value_type = typename Container::value_type; // Explicit constructors instead of `using Container::Container` // otherwise older compilers choke on it (GCC <= 5.5, xcode <= 9.4) diff --git a/single_include/nlohmann/json.hpp b/single_include/nlohmann/json.hpp index 92aa8aef0..88d4d8853 100644 --- a/single_include/nlohmann/json.hpp +++ b/single_include/nlohmann/json.hpp @@ -17041,10 +17041,10 @@ template , using key_type = Key; using mapped_type = T; using Container = std::vector, Allocator>; - using typename Container::iterator; - using typename Container::const_iterator; - using typename Container::size_type; - using typename Container::value_type; + using iterator = typename Container::iterator; + using const_iterator = typename Container::const_iterator; + using size_type = typename Container::size_type; + using value_type = typename Container::value_type; // Explicit constructors instead of `using Container::Container` // otherwise older compilers choke on it (GCC <= 5.5, xcode <= 9.4) diff --git a/test/cuda_example/json_cuda.cu b/test/cuda_example/json_cuda.cu index 1d4057680..d686cd0f8 100644 --- a/test/cuda_example/json_cuda.cu +++ b/test/cuda_example/json_cuda.cu @@ -4,4 +4,8 @@ int main() { nlohmann::ordered_json json = {"Test"}; json.dump(); + + // regression for #3013 (ordered_json::reset() compile error with nvcc) + nlohmann::ordered_json metadata; + metadata.erase("key"); }