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
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-dev