Bug 131006 - std::bind not compiling with Visual Studio
Summary: std::bind not compiling with Visual Studio
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Template Framework (show other bugs)
Version: 528+ (Nightly build)
Hardware: PC Windows 7
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-03-31 20:33 PDT by Alex Christensen
Modified: 2014-04-02 07:28 PDT (History)
16 users (show)

See Also:


Attachments
Patch (2.21 KB, patch)
2014-03-31 20:37 PDT, Alex Christensen
no flags Details | Formatted Diff | Diff
Patch (4.90 KB, patch)
2014-03-31 20:50 PDT, Alex Christensen
no flags Details | Formatted Diff | Diff
Patch (12.83 KB, patch)
2014-04-01 13:09 PDT, Alex Christensen
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Alex Christensen 2014-03-31 20:33:55 PDT
I'm getting lots of compile errors like this when compiling after r166496 and I'm trying to avoid adding template parameters everywhere.  This is a shot-in-the dark solution.


1>..\platform\graphics\gstreamer\WebKitWebSourceGStreamer.cpp(745): error C2668: 'WTF::GMainLoopSource::schedule' : ambiguous call to overloaded function
                 C:\Projects\BuildSlave\win-cairo-release\build\WebKitBuild\Release_WinCairo\include\private\wtf/gobject/GMainLoopSource.h(55): could be 'void WTF::GMainLoopSource::schedule(const char *,std::function<bool (GIOCondition)>,GSocket *,GIOCondition,std::function<void (void)>,GMainContext *)'
                 C:\Projects\BuildSlave\win-cairo-release\build\WebKitBuild\Release_WinCairo\include\private\wtf/gobject/GMainLoopSource.h(54): or       'void WTF::GMainLoopSource::schedule(const char *,std::function<bool (void)>,int,std::function<void (void)>,GMainContext *)'
                 C:\Projects\BuildSlave\win-cairo-release\build\WebKitBuild\Release_WinCairo\include\private\wtf/gobject/GMainLoopSource.h(53): or       'void WTF::GMainLoopSource::schedule(const char *,std::function<void (void)>,int,std::function<void (void)>,GMainContext *)'
                 while trying to match the argument list '(const char [32], std::_Bind<true,void,void (__cdecl *const )(WebKitWebSrc *),WebKitWebSrc *&>, int, webKitWebSrcSeekDataCb::<lambda_d0654a0fb2d903f9cc92bf36e3e47024>)'
Comment 1 Alex Christensen 2014-03-31 20:37:03 PDT
Created attachment 228236 [details]
Patch
Comment 2 Alex Christensen 2014-03-31 20:50:11 PDT
Created attachment 228238 [details]
Patch
Comment 3 Carlos Garcia Campos 2014-04-01 00:28:12 PDT
Comment on attachment 228238 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=228238&action=review

We use the versions with the bool function to decide whether to use g_idle or g_timeout, if you remove the versions receiving a bool function it's impossible to implement a repeating source. I guess the problem with visual studio is that the compiler doesn't know which one to use, so a possible workaround would be to add a cast in the callers, see the discussion here: https://bugs.webkit.org/show_bug.cgi?id=130027#c15

> Source/WTF/ChangeLog:4
> +        [WinCairo] Build fix after r166496.
> +        https://bugs.webkit.org/show_bug.cgi?id=131006

Removing the code that doesn't build for you is not a build fix :-)
Comment 4 Alex Christensen 2014-04-01 13:03:08 PDT
> Removing the code that doesn't build for you is not a build fix :-)
That's why it was a shot in the dark.  I was just hoping that nobody would ever need to use the bool version :)

I added some std::function<void ()> constructors.  I was going to add static_casts, but I think this is a better solution.
Comment 5 Alex Christensen 2014-04-01 13:09:19 PDT
Created attachment 228311 [details]
Patch
Comment 6 Carlos Garcia Campos 2014-04-01 23:50:03 PDT
Comment on attachment 228311 [details]
Patch

Thanks for confirming that was indeed the problem, and sorry for the build break.
Comment 7 WebKit Commit Bot 2014-04-02 07:28:09 PDT
Comment on attachment 228311 [details]
Patch

Clearing flags on attachment: 228311

Committed r166643: <http://trac.webkit.org/changeset/166643>
Comment 8 WebKit Commit Bot 2014-04-02 07:28:15 PDT
All reviewed patches have been landed.  Closing bug.