diff --git a/include/nlohmann/ordered_map.hpp b/include/nlohmann/ordered_map.hpp index bfcf89a40..4325a17b0 100644 --- a/include/nlohmann/ordered_map.hpp +++ b/include/nlohmann/ordered_map.hpp @@ -30,7 +30,8 @@ template , // Explicit constructors instead of `using Container::Container` // otherwise older compilers choke on it (GCC <= 5.5, xcode <= 9.4) - ordered_map(const Allocator& alloc = Allocator()) : Container{alloc} {} + ordered_map() noexcept(noexcept(Container())) : Container{} {} + explicit ordered_map(const Allocator& alloc) noexcept(noexcept(Container(alloc))) : Container{alloc} {} template ordered_map(It first, It last, const Allocator& alloc = Allocator()) : Container{first, last, alloc} {} diff --git a/single_include/nlohmann/json.hpp b/single_include/nlohmann/json.hpp index 00a5b0d22..fb2c44215 100644 --- a/single_include/nlohmann/json.hpp +++ b/single_include/nlohmann/json.hpp @@ -17066,7 +17066,8 @@ template , // Explicit constructors instead of `using Container::Container` // otherwise older compilers choke on it (GCC <= 5.5, xcode <= 9.4) - ordered_map(const Allocator& alloc = Allocator()) : Container{alloc} {} + ordered_map() noexcept(noexcept(Container())) : Container{} {} + explicit ordered_map(const Allocator& alloc) noexcept(noexcept(Container(alloc))) : Container{alloc} {} template ordered_map(It first, It last, const Allocator& alloc = Allocator()) : Container{first, last, alloc} {} diff --git a/test/src/unit-alt-string.cpp b/test/src/unit-alt-string.cpp index 2c599a451..7da69dea1 100644 --- a/test/src/unit-alt-string.cpp +++ b/test/src/unit-alt-string.cpp @@ -104,12 +104,12 @@ class alt_string } template - bool operator<(const op_type& op) const + bool operator<(const op_type& op) const noexcept { return str_impl < op; } - bool operator<(const alt_string& op) const + bool operator<(const alt_string& op) const noexcept { return str_impl < op.str_impl; } diff --git a/test/src/unit-regression2.cpp b/test/src/unit-regression2.cpp index 7c466b0b3..e7fe3443f 100644 --- a/test/src/unit-regression2.cpp +++ b/test/src/unit-regression2.cpp @@ -341,7 +341,7 @@ TEST_CASE("regression tests 2") ] })"; - json::parser_callback_t cb = [&](int /*level*/, json::parse_event_t event, json & parsed) + json::parser_callback_t cb = [&](int /*level*/, json::parse_event_t event, json & parsed) noexcept { // skip uninteresting events if (event == json::parse_event_t::value && !parsed.is_primitive())