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

out_value is broken #20

Open
fhoefling opened this issue Oct 6, 2014 · 0 comments
Open

out_value is broken #20

fhoefling opened this issue Oct 6, 2014 · 0 comments

Comments

@fhoefling
Copy link

The policy "out_value" seems to be broken (for a long time?), it is also not covered by the tests (test_policies.cpp has "pure_out_value" only). The following example is copied from the luabind documentation, GCC and Clang generate an error about calling a non-static member function:

.../luabind/out_value_policy.hpp:126:71: error: cannot call member function ‘int luabind::native_converter_base::match(lua_State*, luabind::detail::by_value, int) [with T = float; Derived = luabind::default_converter; lua_State = lua_State]’ without object
             return converter::match(L, LUABIND_DECORATE_TYPE(T), index);

Example:

#include "test.hpp"

#include 
#include 

void f(float& val) { val = val + 10.f; }

void test_main(lua_State* L)
{
    using namespace luabind;

    module(L)
    [
         def("f", &f, out_value(_1)) // compiles with "pure_out_value"
    ];

    // out_value
    DOSTRING(L,
        "a = f(5)\n"
        "assert(a == 15)");
}
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

Successfully merging a pull request may close this issue.

1 participant