Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Recommended" way of binding specific function overloads doesn't work on clang 14 #612

Open
totalgee opened this issue Aug 17, 2023 · 0 comments

Comments

@totalgee
Copy link
Contributor

  • 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).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant