From 3f805e9bf97b7c3f6af94d8ee63d94d9b32211da Mon Sep 17 00:00:00 2001 From: Haowen Liu Date: Sun, 20 Apr 2025 17:42:24 -0400 Subject: [PATCH] Fix string_arg when used with rref When passing in a rvalue reference, compiler considers it ambiguous between std::string and std::string&&. Making one of them take a lvalue reference makes compilers correctly pick the right one depending on whether the passed in value binds to a rvalue or lvalue reference. --- subprocess.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subprocess.hpp b/subprocess.hpp index 24fa303..9029647 100755 --- a/subprocess.hpp +++ b/subprocess.hpp @@ -706,7 +706,7 @@ struct string_arg { string_arg(const char* arg): arg_value(arg) {} string_arg(std::string&& arg): arg_value(std::move(arg)) {} - string_arg(std::string arg): arg_value(std::move(arg)) {} + string_arg(const std::string& arg): arg_value(arg) {} std::string arg_value; };