- Compiler Used: clang 14.0
- Operating System: Ubuntu 22.04.2 LTS
- Architecture (ARM/x86/32bit/64bit/etc): x64
Expected Behavior
Previously, I could bind overloaded functions and methods with the fun<> template (preferred method), but now the only thing that works is using static_cast (aka alternative method).
Actual Behavior
A compiler error message similar to:
/home/various_dirs/src/scripting.cpp:1117:35: error: no matching function for call to 'fun'
Minimal Example to Reproduce Behavior
For a function (in a namespace ci) that has two overloads, like this:
std::vector<std::string> split( const std::string &str, char separator, bool compress = true );
std::vector<std::string> split( const std::string &str, const std::string &separators, bool compress = true );
Binding in ChaiScript like this:
m->add(fun<std::vector<string>(string const&, string const&, bool)>(&ci::split), "split");
gives the above-mentioned compiler error, whereas the static_cast approach:
m->add(fun(static_cast<std::vector<string>(*)(string const&, string const&, bool)>(&ci::split)), "split");
compiles fine. On other compilers I've used, such as VS 2022, it builds fine (also with C++17 switches).
Expected Behavior
Previously, I could bind overloaded functions and methods with the
fun<>template (preferred method), but now the only thing that works is usingstatic_cast(aka alternative method).Actual Behavior
A compiler error message similar to:
Minimal Example to Reproduce Behavior
For a function (in a namespace
ci) that has two overloads, like this:Binding in ChaiScript like this:
gives the above-mentioned compiler error, whereas the
static_castapproach:compiles fine. On other compilers I've used, such as VS 2022, it builds fine (also with C++17 switches).