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

More visual studio compiler errors #6

Open
nicokruithof opened this issue Jan 18, 2012 · 1 comment
Open

More visual studio compiler errors #6

nicokruithof opened this issue Jan 18, 2012 · 1 comment

Comments

@nicokruithof
Copy link

The following code compiles fine on linux (gcc), but gives an error on windows (visual studio)

class Test
{
public:
    Test()
    {
        std::cout << "Test()" << std::endl;
    }
    void open(const std::string &filename)
    {
        std::cout << "Opening: " << filename << std::endl;
    }
    void close()
    {
        std::cout << "Closing" << std::endl;
    }
};

...
vu8::Class<Test> renderer_class;
renderer_class
            .Set<void (), &Test::close>("close")
            .Set<void (const std::string&), &Test::open>("open");

The error is:

error C2440: 'specialization' : cannot convert from 'void (__thiscall Test::* )(void)' to 'void (__thiscall Test::* const )(const v8::Arguments &)(void)'
  Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
error C2973: 'vu8::Class<T>::Set' : invalid template argument 'void (__thiscall Test::* )(void)'
with
[
  T=Test
]
vu8/Class.hpp(168) : see declaration of 'vu8::Class<T>::Set'
with
[
   T=Test
]
error C2440: 'specialization' : cannot convert from 'void (__thiscall Test::* )(void)' to 'void (__thiscall Test::* const )(void) const'
Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
@tsa
Copy link
Owner

tsa commented Mar 21, 2012

You could attempt to rename the const specialisation and compile again?

I can't test this under Visual Studio at the moment as I have no windows machine.

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

2 participants