# Const returning C++ method can't be bound with LuaBridge

I have a method with this signature:

const std::string GameObject::GetName()


And then I try to bind it with this line:

...
...


When I try to compile, this error comes up:

Error C2440 '=': cannot convert from
'const std::basic_string<char,std::char_traits<char>,std::allocator<char>> *'
to
'void *'


The error comes from here:

\include\luabridge\detail\Userdata.h, line: 354


Here is a snippet from the Userdata.h

  inline T* getObject ()
{
// If this fails to compile it means you forgot to provide
// a Container specialization for your container!
//
return reinterpret_cast <T*> (&m_storage [0]);
}

private:
/**
Used for placement construction.
*/
UserdataValue ()
{
m_p = getObject(); //Line 354
}


I can use const, and const & std::string as parameters, in those cases there are no errors.

Why does this error occur? How could I fix this?

As for fixing your project, just remove the const, it doesn't make sense anyway since you're returning a value.