-
Notifications
You must be signed in to change notification settings - Fork 138
Closed
Description
A code example from https://www.boost.org/doc/libs/1_80_0_beta1/doc/html/process.html#boost_process.introduction fails to compile:
$ x86_64-w64-mingw32-g++-posix --version
x86_64-w64-mingw32-g++-posix (GCC) 10-posix 20220113
Copyright (C) 2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
$ x86_64-w64-mingw32-g++-posix -std=c++17 process_demo.cpp -o process_demo.exe -I/home/hebasto/Boost.Dev/boost_1_80_0_b1/boost_1_80_0 -DBOOST_PROCESS_USE_STD_FS -lws2_32 -static
In file included from /home/hebasto/Boost.Dev/boost_1_80_0_b1/boost_1_80_0/boost/process/detail/basic_cmd.hpp:17,
from /home/hebasto/Boost.Dev/boost_1_80_0_b1/boost_1_80_0/boost/process/args.hpp:33,
from /home/hebasto/Boost.Dev/boost_1_80_0_b1/boost_1_80_0/boost/process.hpp:22,
from process_demo.cpp:3:
/home/hebasto/Boost.Dev/boost_1_80_0_b1/boost_1_80_0/boost/process/detail/windows/basic_cmd.hpp: In static member function ‘static std::string boost::process::detail::windows::exe_cmd_init<Char>::get_shell(char)’:
/home/hebasto/Boost.Dev/boost_1_80_0_b1/boost_1_80_0/boost/process/detail/windows/basic_cmd.hpp:162:77: error: no matching function for call to ‘std::filesystem::__cxx11::path::string(const codecvt_type&)’
162 | static std:: string get_shell(char) {return shell(). string(codecvt()); }
| ^
In file included from /usr/lib/gcc/x86_64-w64-mingw32/10-posix/include/c++/filesystem:45,
from /home/hebasto/Boost.Dev/boost_1_80_0_b1/boost_1_80_0/boost/process/filesystem.hpp:9,
from /home/hebasto/Boost.Dev/boost_1_80_0_b1/boost_1_80_0/boost/process/detail/traits/cmd_or_exe.hpp:14,
from /home/hebasto/Boost.Dev/boost_1_80_0_b1/boost_1_80_0/boost/process/detail/basic_cmd.hpp:13,
from /home/hebasto/Boost.Dev/boost_1_80_0_b1/boost_1_80_0/boost/process/args.hpp:33,
from /home/hebasto/Boost.Dev/boost_1_80_0_b1/boost_1_80_0/boost/process.hpp:22,
from process_demo.cpp:3:
/usr/lib/gcc/x86_64-w64-mingw32/10-posix/include/c++/bits/fs_path.h:1086:5: note: candidate: ‘template<class _CharT, class _Traits, class _Allocator> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::filesystem::__cxx11::path::string(const _Allocator&) const’
1086 | path::string(const _Allocator& __a) const
| ^~~~
/usr/lib/gcc/x86_64-w64-mingw32/10-posix/include/c++/bits/fs_path.h:1086:5: note: template argument deduction/substitution failed:
In file included from /home/hebasto/Boost.Dev/boost_1_80_0_b1/boost_1_80_0/boost/process/detail/basic_cmd.hpp:17,
from /home/hebasto/Boost.Dev/boost_1_80_0_b1/boost_1_80_0/boost/process/args.hpp:33,
from /home/hebasto/Boost.Dev/boost_1_80_0_b1/boost_1_80_0/boost/process.hpp:22,
from process_demo.cpp:3:
/home/hebasto/Boost.Dev/boost_1_80_0_b1/boost_1_80_0/boost/process/detail/windows/basic_cmd.hpp:162:77: note: couldn’t deduce template parameter ‘_CharT’
162 | static std:: string get_shell(char) {return shell(). string(codecvt()); }
| ^
In file included from /usr/lib/gcc/x86_64-w64-mingw32/10-posix/include/c++/filesystem:45,
from /home/hebasto/Boost.Dev/boost_1_80_0_b1/boost_1_80_0/boost/process/filesystem.hpp:9,
from /home/hebasto/Boost.Dev/boost_1_80_0_b1/boost_1_80_0/boost/process/detail/traits/cmd_or_exe.hpp:14,
from /home/hebasto/Boost.Dev/boost_1_80_0_b1/boost_1_80_0/boost/process/detail/basic_cmd.hpp:13,
from /home/hebasto/Boost.Dev/boost_1_80_0_b1/boost_1_80_0/boost/process/args.hpp:33,
from /home/hebasto/Boost.Dev/boost_1_80_0_b1/boost_1_80_0/boost/process.hpp:22,
from process_demo.cpp:3:
/usr/lib/gcc/x86_64-w64-mingw32/10-posix/include/c++/bits/fs_path.h:1095:3: note: candidate: ‘std::string std::filesystem::__cxx11::path::string() const’
1095 | path::string() const { return string<char>(); }
| ^~~~
/usr/lib/gcc/x86_64-w64-mingw32/10-posix/include/c++/bits/fs_path.h:1095:3: note: candidate expects 0 arguments, 1 provided
In file included from /home/hebasto/Boost.Dev/boost_1_80_0_b1/boost_1_80_0/boost/process/detail/basic_cmd.hpp:17,
from /home/hebasto/Boost.Dev/boost_1_80_0_b1/boost_1_80_0/boost/process/args.hpp:33,
from /home/hebasto/Boost.Dev/boost_1_80_0_b1/boost_1_80_0/boost/process.hpp:22,
from process_demo.cpp:3:
/home/hebasto/Boost.Dev/boost_1_80_0_b1/boost_1_80_0/boost/process/detail/windows/basic_cmd.hpp: In static member function ‘static std::wstring boost::process::detail::windows::exe_cmd_init<Char>::get_shell(wchar_t)’:
/home/hebasto/Boost.Dev/boost_1_80_0_b1/boost_1_80_0/boost/process/detail/windows/basic_cmd.hpp:163:77: error: no matching function for call to ‘std::filesystem::__cxx11::path::wstring(const codecvt_type&)’
163 | static std::wstring get_shell(wchar_t) {return shell().wstring(codecvt());}
| ^
In file included from /usr/lib/gcc/x86_64-w64-mingw32/10-posix/include/c++/filesystem:45,
from /home/hebasto/Boost.Dev/boost_1_80_0_b1/boost_1_80_0/boost/process/filesystem.hpp:9,
from /home/hebasto/Boost.Dev/boost_1_80_0_b1/boost_1_80_0/boost/process/detail/traits/cmd_or_exe.hpp:14,
from /home/hebasto/Boost.Dev/boost_1_80_0_b1/boost_1_80_0/boost/process/detail/basic_cmd.hpp:13,
from /home/hebasto/Boost.Dev/boost_1_80_0_b1/boost_1_80_0/boost/process/args.hpp:33,
from /home/hebasto/Boost.Dev/boost_1_80_0_b1/boost_1_80_0/boost/process.hpp:22,
from process_demo.cpp:3:
/usr/lib/gcc/x86_64-w64-mingw32/10-posix/include/c++/bits/fs_path.h:1099:3: note: candidate: ‘std::wstring std::filesystem::__cxx11::path::wstring() const’
1099 | path::wstring() const { return string<wchar_t>(); }
| ^~~~
/usr/lib/gcc/x86_64-w64-mingw32/10-posix/include/c++/bits/fs_path.h:1099:3: note: candidate expects 0 arguments, 1 provided
A suggested fix:
--- a/include/boost/process/detail/windows/basic_cmd.hpp
+++ b/include/boost/process/detail/windows/basic_cmd.hpp
@@ -159,8 +159,13 @@ struct exe_cmd_init : handler_base_ext
return exe_cmd_init<Char>(std::move(sh), std::move(args_));
}
+#ifdef BOOST_PROCESS_USE_STD_FS
+ static std:: string get_shell(char) {return shell(). string(); }
+ static std::wstring get_shell(wchar_t) {return shell().wstring(); }
+#else
static std:: string get_shell(char) {return shell(). string(codecvt()); }
static std::wstring get_shell(wchar_t) {return shell().wstring(codecvt());}
+#endif
static exe_cmd_init<Char> cmd_shell(string_type&& cmd)
{
Metadata
Metadata
Assignees
Labels
No labels