
On Thu, Sep 17, 2009 at 1:46 PM, Stewart, Robert <Robert.Stewart@sig.com> wrote:
Emil Dotchevski wrote:
On MSVC, the following correct code produces error C2896: 'void operator ||(T,void (__cdecl *)(tag<X>))' : cannot use function template 'void bar(tag<X>)' as a function argument.
struct foo { };
template <int X> struct tag { };
template <int X> void bar( tag<X> ) { }
template <class T,int X> void operator||(T, void(*)(tag<X>)) { }
int main() { foo()||bar<1>; }
I think the problem is that the function template is a __thiscall * rather than the default __cdecl *. Thus, for MSVC (only), adding the following might solve your problem:
template <class T, int X> void operator ||(T, void (__thiscall *)(tag<X>)) { }
No it isn't __thiscall, bar is a global function template (op|| is also global.) Emil Dotchevski Reverge Studios, Inc. http://www.revergestudios.com/reblog/index.php?n=ReCode