util/cexec: Fix bug in std::string helper
Change-Id: Ic561f96986763a1c4626deb8a1c39ba1fa1573b2
Signed-off-by: William A. Kennington III <wak@google.com>
diff --git a/src/stdplus/util/cexec.hpp b/src/stdplus/util/cexec.hpp
index 252d257..822067a 100644
--- a/src/stdplus/util/cexec.hpp
+++ b/src/stdplus/util/cexec.hpp
@@ -84,7 +84,7 @@
typename... Args>
inline auto callCheckErrno(const std::string& msg, Args&&... args)
{
- return callCheckErrno(msg.c_str(), std::forward(args)...);
+ return callCheckErrno(msg.c_str(), std::forward<Args>(args)...);
}
/** @brief Wraps common c style error handling for exception throwing
@@ -119,7 +119,7 @@
typename... Args>
inline auto callCheckRet(const std::string& msg, Args&&... args)
{
- return callCheckRet(msg.c_str(), std::forward(args)...);
+ return callCheckRet(msg.c_str(), std::forward<Args>(args)...);
}
} // namespace util
diff --git a/test/util/cexec.cpp b/test/util/cexec.cpp
index 51fdb8b..c41c2d4 100644
--- a/test/util/cexec.cpp
+++ b/test/util/cexec.cpp
@@ -69,7 +69,7 @@
TEST(Cexec, CallCheckErrnoInt)
{
EXPECT_EQ(1, callCheckErrno("sample1", sample1));
- EXPECT_EQ(2, callCheckErrno("sample2", &sample2, 2));
+ EXPECT_EQ(2, callCheckErrno(std::string("sample2"), &sample2, 2));
EXPECT_EQ(4, callCheckErrno("sample::s", sample::s, 4));
ssize_t v = 10;
EXPECT_EQ(12, callCheckErrno("sample3", sample3, 2, &v));
@@ -169,7 +169,7 @@
TEST(Cexec, CallCheckRetInt)
{
EXPECT_EQ(1, callCheckRet("sample1", sample1));
- EXPECT_EQ(2, callCheckRet("sample2", &sample2, 2));
+ EXPECT_EQ(2, callCheckRet(std::string("sample2"), &sample2, 2));
EXPECT_EQ(4, callCheckRet("sample::s", sample::s, 4));
ssize_t v = 10;
EXPECT_EQ(12, callCheckRet("sample3", sample3, 2, &v));