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

problem using HttpServerRequestRouter with Visual Studio #79

Open
hmoffatt opened this issue May 2, 2016 · 2 comments
Open

problem using HttpServerRequestRouter with Visual Studio #79

hmoffatt opened this issue May 2, 2016 · 2 comments

Comments

@hmoffatt
Copy link

hmoffatt commented May 2, 2016

I'm having trouble using HttpServerRequestRouter with the VS compiler. I can't compile the sessionusage example. It gives the unhelpful error

1>C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\xrefwrap(283): error C2064: term does not evaluate to a function taking 2 arguments

due to the mapping lines (main.cpp:52-54)

{QRegularExpression{"^/set(?:/(\\w*))?$"}, setHandler},
{QRegularExpression{"^/read(?:/(\\w*))?$"}, readHandler},
{QRegularExpression{"^/unset(?:/(\\w*))?$"}, unsetHandler},

This simple code doesn't compile

Tufao::NotFoundHandler notfound;
Tufao::HttpServerRequestRouter::Mapping m;
m.handler = notfound;

Unfortunately if you Google "vs 2013 xrefwrap _Ret std::_Callable_obj" you get heaps of errors like this one. Seems to be a problem with std::function in VS 2013 with no simple workaround.

@hmoffatt
Copy link
Author

hmoffatt commented May 2, 2016

The compile error is

1>  main.cpp
1>C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\xrefwrap(283): error C2064: term does not evaluate to a function taking 2 arguments
1>          C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\functional(228) : see reference to function template instantiation '_Ret std::_Callable_obj<Tufao::NotFoundHandler,false>::_ApplyX<_Rx,Tufao::HttpServerRequest&,Tufao::HttpServerResponse&>(Tufao::HttpServerRequest &,Tufao::HttpServerResponse &)' being compiled
1>          with
1>          [
1>              _Ret=bool
1>  ,            _Rx=bool
1>          ]
1>          C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\functional(228) : see reference to function template instantiation '_Ret std::_Callable_obj<Tufao::NotFoundHandler,false>::_ApplyX<_Rx,Tufao::HttpServerRequest&,Tufao::HttpServerResponse&>(Tufao::HttpServerRequest &,Tufao::HttpServerResponse &)' being compiled
1>          with
1>          [
1>              _Ret=bool
1>  ,            _Rx=bool
1>          ]

@vinipsmaker
Copy link
Owner

Thanks for the report. Unfortunately, I don't have a Windows machine laying around or much time to play with this.

Maybe I should setup AppVeyor for this project just like I did for another project of mine.

However, if std::function doesn't work on Visual Studio 2013, there's no way to fix this issue without breaking API. And I'm not willing to break API. Development versions of Tufão can break the API, but if the API is worse, I'm not willing to accept the proposals. This looks a tough issue.

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