You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
On Windows compilation fails if std::filesystem::path type is passed to Lua. Similar issue happens when registering custom usertype or customization traits for std::filesystem::path.
Sol2 v3.3.0
This code does not compile on MSVC (VS 2022, MSVC 19.38.33133), but compiles on Windows with GCC (GCC 11.4.0, MinGW 13.2.0-rt_v11-rev0)
Compilation error message on MSVC
Expand error
C:\Users\zziger\AppData\Local\.xmake\packages\s\sol2\v3.3.0\1aa9b23f2d2040d49728efabdcb8d03d\include\sol/stack_core.hpp(897): error C2664: 'int sol::stack::unqualified_pusher<wchar_t,void>::push(lua_State *,wchar_t)': cannot convert argument 2 from 'const std::filesystem::path' to 'wchar_t'
C:\Users\zziger\AppData\Local\.xmake\packages\s\sol2\v3.3.0\1aa9b23f2d2040d49728efabdcb8d03d\include\sol/stack_core.hpp(897): note: No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
C:\Users\zziger\AppData\Local\.xmake\packages\s\sol2\v3.3.0\1aa9b23f2d2040d49728efabdcb8d03d\include\sol/stack_push.hpp(1226): note: see declaration of 'sol::stack::unqualified_pusher<wchar_t,void>::push'
C:\Users\zziger\AppData\Local\.xmake\packages\s\sol2\v3.3.0\1aa9b23f2d2040d49728efabdcb8d03d\include\sol/stack_core.hpp(897): note: while trying to match the argument list '(lua_State *, const std::filesystem::path)'
C:\Users\zziger\AppData\Local\.xmake\packages\s\sol2\v3.3.0\1aa9b23f2d2040d49728efabdcb8d03d\include\sol/stack_core.hpp(897): note: the template instantiation context (the oldest one first) is
main.cpp(23): note: see reference to function template instantiation 'sol::table_proxy<sol::global_table &,std::tuple<const char (&)[5]>> &&sol::table_proxy<sol::global_table &,std::tuple<const char (&)[5]>>::operator =<std::filesystem::path>(T &&) &&' being compiled
with
[
T=std::filesystem::path
]
main.cpp(23): note: see the first reference to 'sol::table_proxy<sol::global_table &,std::tuple<const char (&)[5]>>::operator =' in 'main'
C:\Users\zziger\AppData\Local\.xmake\packages\s\sol2\v3.3.0\1aa9b23f2d2040d49728efabdcb8d03d\include\sol/table_proxy.hpp(122): note: see reference to function template instantiation 'sol::table_proxy<sol::global_table &,std::tuple<const char (&)[5]>> &&sol::table_proxy<sol::global_table &,std::tuple<const char (&)[5]>>::set<_Ty>(T &&) &&' being compiled
with
[
_Ty=std::filesystem::path,
T=std::filesystem::path
]
C:\Users\zziger\AppData\Local\.xmake\packages\s\sol2\v3.3.0\1aa9b23f2d2040d49728efabdcb8d03d\include\sol/table_proxy.hpp(88): note: see reference to function template instantiation 'void sol::table_proxy<sol::global_table &,std::tuple<const char (&)[5]>>::tuple_set<0,_Ty>(std::integer_sequence<size_t,0>,T &&) &&' being compiled
with
[
_Ty=std::filesystem::path,
T=std::filesystem::path
]
C:\Users\zziger\AppData\Local\.xmake\packages\s\sol2\v3.3.0\1aa9b23f2d2040d49728efabdcb8d03d\include\sol/table_proxy.hpp(56): note: see reference to function template instantiation 'sol::basic_table_core<true,sol::reference> &sol::basic_table_core<true,sol::reference>::traverse_set<const char(&)[5],_Ty>(const char (&)[5],_Ty &&)' being compiled
with
[
_Ty=std::filesystem::path
]
C:\Users\zziger\AppData\Local\.xmake\packages\s\sol2\v3.3.0\1aa9b23f2d2040d49728efabdcb8d03d\include\sol/table_core.hpp(462): note: see reference to function template instantiation 'void sol::basic_table_core<true,sol::reference>::traverse_set_deep<true,false,sol::detail::none,const char(&)[5],_Ty>(int,Key,_Ty &&) const' being compiled
with
[
_Ty=std::filesystem::path,
Key=const char (&)[5]
]
C:\Users\zziger\AppData\Local\.xmake\packages\s\sol2\v3.3.0\1aa9b23f2d2040d49728efabdcb8d03d\include\sol/table_core.hpp(264): note: see reference to function template instantiation 'void sol::stack::set_field<true,false,const char(&)[5],_Ty>(lua_State *,Key,Value &&,int)' being compiled
with
[
_Ty=std::filesystem::path,
Key=const char (&)[5],
Value=std::filesystem::path
]
C:\Users\zziger\AppData\Local\.xmake\packages\s\sol2\v3.3.0\1aa9b23f2d2040d49728efabdcb8d03d\include\sol/stack_core.hpp(1250): note: see reference to function template instantiation 'void sol::stack::field_setter<char [5],true,false,void>::set<const char(&)[5],_Ty>(lua_State *,Key,Value &&,int)' being compiled
with
[
_Ty=std::filesystem::path,
Key=const char (&)[5],
Value=std::filesystem::path
]
C:\Users\zziger\AppData\Local\.xmake\packages\s\sol2\v3.3.0\1aa9b23f2d2040d49728efabdcb8d03d\include\sol/stack_field.hpp(217): note: see reference to function template instantiation 'int sol::stack::push<_Ty,>(lua_State *,T &&)' being compiled
with
[
_Ty=std::filesystem::path,
T=std::filesystem::path
]
C:\Users\zziger\AppData\Local\.xmake\packages\s\sol2\v3.3.0\1aa9b23f2d2040d49728efabdcb8d03d\include\sol/stack_core.hpp(878): note: see reference to function template instantiation 'int sol::stack::unqualified_pusher<Tu,void>::push<_Ty>(lua_State *,_Ty &&)' being compiled
with
[
_Ty=std::filesystem::path
]
C:\Users\zziger\AppData\Local\.xmake\packages\s\sol2\v3.3.0\1aa9b23f2d2040d49728efabdcb8d03d\include\sol/stack_push.hpp(372): note: see reference to function template instantiation 'int sol::stack::push<sol::detail::as_value_tag<T>,_Ty,,void>(lua_State *,Arg &&)' being compiled
with
[
T=Tu,
_Ty=std::filesystem::path,
Arg=std::filesystem::path
]
C:\Users\zziger\AppData\Local\.xmake\packages\s\sol2\v3.3.0\1aa9b23f2d2040d49728efabdcb8d03d\include\sol/stack_core.hpp(897): note: see reference to function template instantiation 'int sol::stack::unqualified_pusher<Tu,void>::push<_Ty,>(lua_State *,Arg &&)' being compiled
with
[
_Ty=std::filesystem::path,
Arg=std::filesystem::path
]
C:\Users\zziger\AppData\Local\.xmake\packages\s\sol2\v3.3.0\1aa9b23f2d2040d49728efabdcb8d03d\include\sol/stack_push.hpp(186): note: see reference to function template instantiation 'int sol::stack::unqualified_pusher<Tu,void>::push_keyed<const std::string&,_Ty>(lua_State *,K,_Ty &&)' being compiled
with
[
_Ty=std::filesystem::path,
K=const std::string &
]
C:\Users\zziger\AppData\Local\.xmake\packages\s\sol2\v3.3.0\1aa9b23f2d2040d49728efabdcb8d03d\include\sol/stack_push.hpp(175): note: see reference to function template instantiation 'void sol::stack::stack_detail::set_undefined_methods_on<T>(sol::stack_reference)' being compiled
with
[
T=Tu
]
C:\Users\zziger\AppData\Local\.xmake\packages\s\sol2\v3.3.0\1aa9b23f2d2040d49728efabdcb8d03d\include\sol/usertype_core.hpp(193): note: see reference to function template instantiation 'void sol::detail::insert_default_registrations<T,sol::detail::indexed_insert&,bool(__cdecl &)(sol::meta_function)>(IFx,Fx)' being compiled
with
[
IFx=sol::detail::indexed_insert &,
Fx=bool (__cdecl &)(sol::meta_function)
]
C:\Users\zziger\AppData\Local\.xmake\packages\s\sol2\v3.3.0\1aa9b23f2d2040d49728efabdcb8d03d\include\sol/usertype_core.hpp(126): note: see reference to class template instantiation 'sol::container_detail::u_c_launch<sol::as_container_t<T>>' being compiled
C:\Users\zziger\AppData\Local\.xmake\packages\s\sol2\v3.3.0\1aa9b23f2d2040d49728efabdcb8d03d\include\sol/usertype_container_launch.hpp(132): note: while compiling class template member function 'int sol::container_detail::u_c_launch<sol::as_container_t<T>>::real_pairs_call(lua_State *)'
C:\Users\zziger\AppData\Local\.xmake\packages\s\sol2\v3.3.0\1aa9b23f2d2040d49728efabdcb8d03d\include\sol/usertype_container_launch.hpp(133): note: see reference to alias template instantiation 'sol::container_detail::has_traits_pairs<sol::usertype_container<sol::as_container_t<T>>>' being compiled
C:\Users\zziger\AppData\Local\.xmake\packages\s\sol2\v3.3.0\1aa9b23f2d2040d49728efabdcb8d03d\include\sol/usertype_container_launch.hpp(133): note: see reference to class template instantiation 'sol::container_detail::has_traits_pairs_test<sol::usertype_container<sol::as_container_t<T>>>' being compiled
C:\Users\zziger\AppData\Local\.xmake\packages\s\sol2\v3.3.0\1aa9b23f2d2040d49728efabdcb8d03d\include\sol/usertype_container.hpp(235): note: see reference to class template instantiation 'sol::usertype_container<sol::as_container_t<T>>' being compiled
C:\Users\zziger\AppData\Local\.xmake\packages\s\sol2\v3.3.0\1aa9b23f2d2040d49728efabdcb8d03d\include\sol/usertype_container.hpp(1559): note: see reference to class template instantiation 'sol::container_detail::usertype_container_default<sol::as_container_t<T>,void>' being compiled
C:\Users\zziger\AppData\Local\.xmake\packages\s\sol2\v3.3.0\1aa9b23f2d2040d49728efabdcb8d03d\include\sol/usertype_container.hpp(1366): note: while compiling class template member function 'int sol::container_detail::usertype_container_default<sol::as_container_t<T>,void>::pairs(lua_State *)'
C:\Users\zziger\AppData\Local\.xmake\packages\s\sol2\v3.3.0\1aa9b23f2d2040d49728efabdcb8d03d\include\sol/usertype_container_launch.hpp(125): note: see the first reference to 'sol::container_detail::usertype_container_default<sol::as_container_t<T>,void>::pairs' in 'sol::container_detail::u_c_launch<sol::as_container_t<T>>::real_pairs_traits'
C:\Users\zziger\AppData\Local\.xmake\packages\s\sol2\v3.3.0\1aa9b23f2d2040d49728efabdcb8d03d\include\sol/usertype_container_launch.hpp(133): note: see the first reference to 'sol::container_detail::u_c_launch<sol::as_container_t<T>>::real_pairs_traits' in 'sol::container_detail::u_c_launch<sol::as_container_t<T>>::real_pairs_call'
C:\Users\zziger\AppData\Local\.xmake\packages\s\sol2\v3.3.0\1aa9b23f2d2040d49728efabdcb8d03d\include\sol/usertype_container.hpp(1368): note: see reference to function template instantiation 'int sol::container_detail::usertype_container_default<sol::as_container_t<T>,void>::pairs_associative<false>(std::false_type,lua_State *)' being compiled
C:\Users\zziger\AppData\Local\.xmake\packages\s\sol2\v3.3.0\1aa9b23f2d2040d49728efabdcb8d03d\include\sol/usertype_container.hpp(1232): note: see reference to function template instantiation 'int sol::container_detail::usertype_container_default<sol::as_container_t<T>,void>::next_iter<false>(lua_State *)' being compiled
C:\Users\zziger\AppData\Local\.xmake\packages\s\sol2\v3.3.0\1aa9b23f2d2040d49728efabdcb8d03d\include\sol/usertype_container.hpp(1217): note: see reference to function template instantiation 'int sol::container_detail::usertype_container_default<sol::as_container_t<T>,void>::next_associative<false>(std::false_type,lua_State *)' being compiled
C:\Users\zziger\AppData\Local\.xmake\packages\s\sol2\v3.3.0\1aa9b23f2d2040d49728efabdcb8d03d\include\sol/usertype_container.hpp(1209): note: see reference to function template instantiation 'int sol::stack::stack_detail::push_reference<wchar_t,const std::filesystem::path&,>(lua_State *,Arg)' being compiled
with
[
Arg=const std::filesystem::path &
]
C:\Users\zziger\AppData\Local\.xmake\packages\s\sol2\v3.3.0\1aa9b23f2d2040d49728efabdcb8d03d\include\sol/stack_core.hpp(936): note: see reference to function template instantiation 'int sol::stack::push<Tr,const std::filesystem::path&,,void>(lua_State *,Arg)' being compiled
with
[
Arg=const std::filesystem::path &
]
> in main.cpp
The text was updated successfully, but these errors were encountered:
On Windows compilation fails if
std::filesystem::path
type is passed to Lua. Similar issue happens when registering custom usertype or customization traits forstd::filesystem::path
.Example code
Sol2 v3.3.0
This code does not compile on MSVC (VS 2022, MSVC 19.38.33133), but compiles on Windows with GCC (GCC 11.4.0, MinGW 13.2.0-rt_v11-rev0)
Compilation error message on MSVC
Expand error
The text was updated successfully, but these errors were encountered: