[webkit-dev] Does someone know how to fix WTF::Function on Windows

Yusuke SUZUKI utatane.tea at gmail.com
Sat Jul 15 09:14:45 PDT 2017


I'm not 100% confident, but can you try it `&testFunction` instead?

Regards,
Yusuke Suzuki

On Sun, Jul 16, 2017 at 1:13 AM, Darin Adler <darin at apple.com> wrote:

> Hi folks.
>
> On Windows, WTF::Function doesn’t quite work right. Code that is something
> like this:
>
>     void addCallback(WTF::Function<void()>&&);
>
>     void testFunction()
>     {
>         // ...
>     }
>
>     void addTestFunction()
>     {
>         addCallback(testFunction);
>     }
>
> Leads to errors like this:
>
>     error C2664: 'void addCallback(WTF::Function<void (void)> &&)': cannot
> convert argument 1 from 'void (__cdecl *)(void)' to 'WTF::Function<void
> (void)> &&'
>     note: You cannot bind an lvalue to an rvalue reference
>
> The problem might have something to do with cdecl vs. stdcall functions,
> but I am not sure that is the problem. It could be some other problem with
> how WTF::Function is written. Or it might even be a bug in the Visual
> Studio compiler. Since I don’t have a Windows machine myself, I was trying
> to use EWS to figure this out but that was slow. Then I tried using
> http://webcompiler.cloudapp.net but I could not reproduce any error there
> when I pasted in cut down code; it just compiled fine.
>
> Is there someone who knows how to fix this?
>
> Another way to put this is: We want to take off the explicit WTF::Function
> conversions in functions like canUseWithReason in SimpleLineLayout.cpp,
> Page::Page in Page.cpp, and Worker::Worker in Worker.cpp and have it still
> compile and work on Windows. Other platforms seem to compile fine without
> the explicit WTF::Function.
>
> — Darin
> _______________________________________________
> webkit-dev mailing list
> webkit-dev at lists.webkit.org
> https://lists.webkit.org/mailman/listinfo/webkit-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-dev/attachments/20170716/601771f9/attachment.html>


More information about the webkit-dev mailing list