Classes named Function will shadow the template Function in WTF/Functional.h. The result can be spectacular template instantiation errors.
For instance
ninja -t msvc -e environment.x86 -- "c:\program files (x86)\microsoft visual studio 14.0\vc\bin\amd64_x86/cl.exe" /nologo /showIncludes @obj/third_party/WebKit/Source/core/unit_tests/testfile.obj.rsp /c ../../third_party/WebKit/Source/core/workers/testfile.cpp /Foobj/third_party
/WebKit/Source/core/unit_tests/testfile.obj /Fd"obj/third_party/WebKit/Source/core/unit_tests_cc.pdb"
../../third_party/WebKit/Source\core/workers/WorkerThread.h(247): error C2947: expecting '>' to terminate template-argument-list, found '<'
../../third_party/WebKit/Source\core/workers/WorkerThread.h(247): error C2628: 'std::unique_ptr<blink::`anonymous-namespace'::Function,std::default_delete<_Ty>>' followed by 'void' is illegal (did you forget a ';'?)
with
[
_Ty=blink::`anonymous-namespace'::Function
]
../../third_party/WebKit/Source\core/workers/WorkerThread.h(247): error C2061: syntax error: identifier 'threadAffinity'
../../third_party/WebKit/Source\platform/CrossThreadFunctional.h(32): error C2947: expecting '>' to terminate template-argument-list, found '<'
../../third_party/WebKit/Source\platform/CrossThreadFunctional.h(32): error C2936: 'base::MakeUnboundRunType<Functor,Args...>': template-id redefined as a global data variable
../..\base/bind.h(29): note: see declaration of 'base::MakeUnboundRunType<Functor,Args...>'
or
e:\b\c\b\win\src\out\release\gen\third_party\webkit\source\core\animation\../../../../../../../../third_party/WebKit/Source/core/workers/DedicatedWorkerTest.cpp(63): error C2672: 'blink::CrossThreadBind': no matching overloaded function found
e:\b\c\b\win\src\out\release\gen\third_party\webkit\source\core\animation\../../../../../../../../third_party/WebKit/Source/core/workers/DedicatedWorkerTest.cpp(63): error C2893: Failed to specialize function template 'std::unique_ptr<WTF::Function<internal::MakeUnboundRunTypeImpl<Functor,BoundArgs...>::Type,WTF::kCrossThreadAffinity>,std::default_delete<_Ty>> blink::CrossThreadBind(FunctionType,Ps &&...)'
with
[
_Ty=WTF::Function<internal::MakeUnboundRunTypeImpl<Functor,BoundArgs...>::Type,WTF::kCrossThreadAffinity>
]
e:\b\c\b\win\src\out\release\gen\third_party\webkit\source\core\animation\../../../../../../../../third_party/WebKit/Source/core/workers/DedicatedWorkerTest.cpp(63): note: With the following template arguments:
e:\b\c\b\win\src\out\release\gen\third_party\webkit\source\core\animation\../../../../../../../../third_party/WebKit/Source/core/workers/DedicatedWorkerTest.cpp(63): note: 'FunctionType=void (__cdecl *)(void)'
e:\b\c\b\win\src\out\release\gen\third_party\webkit\source\core\animation\../../../../../../../../third_party/WebKit/Source/core/workers/DedicatedWorkerTest.cpp(63): note: 'Ps={}'
e:\b\c\b\win\src\out\release\gen\third_party\webkit\source\core\animation\../../../../../../../../third_party/WebKit/Source/core/workers/DedicatedWorkerTest.cpp(63): error C2661: 'blink::WebTaskRunner::PostTask': no overloaded function takes 1 arguments
e:\b\c\b\win\src\out\release\gen\third_party\webkit\source\core\animation\../../../../../../../../third_party/WebKit/Source/core/workers/DedicatedWorkerTest.c
Comment 1 by bugdroid1@chromium.org
, Jul 19 2017