diff --git a/src/env.cpp b/src/env.cpp index 288497a12..9ae4bc2d1 100644 --- a/src/env.cpp +++ b/src/env.cpp @@ -635,7 +635,9 @@ std::shared_ptr> env_scoped_impl_t::create_e assert(var && "Variable should be present in uvars"); // Note that std::map::insert does NOT overwrite a value already in the map, // which we depend on here. - vals.insert(std::move(std::make_pair(std::move(key), std::move(*var)))); + // Note: Using std::move around make_pair prevents the compiler from implementing + // copy elision. + vals.insert(std::make_pair(std::move(key), std::move(*var))); } }