Skip to content

Commit d3f511b

Browse files
lunacdhebasto
authored andcommitted
subprocess: 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. Github-Pull: arun11299/cpp-subprocess#110 Rebased-From: 2d8a8eebb03e509840e2c3c755d1abf32d930f33
1 parent 2fd3f2f commit d3f511b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/util/subprocess.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -527,7 +527,7 @@ struct string_arg
527527
{
528528
string_arg(const char* arg): arg_value(arg) {}
529529
string_arg(std::string&& arg): arg_value(std::move(arg)) {}
530-
string_arg(std::string arg): arg_value(std::move(arg)) {}
530+
string_arg(const std::string& arg): arg_value(arg) {}
531531
std::string arg_value;
532532
};
533533

0 commit comments

Comments
 (0)