Error C2064 for Windows, but not for Linux

Now I am compiling an open source image processing project olena . This is a great image processing library, and I managed to compile it for Linux (4.6.3). Since I'm used to Windows, I am also trying to compile a project on Windows with Visual Studio 2010. However, when I compile it, I have error C2064:

Error 1 error C2064: term does not evaluate to a function taking 0 arguments C:\olena-2.1\olena-2.1\milena\mln\metal\is_a.hh 101 

Following the error message, I came up with this code:

  /*! \internal \brief "is_a" check. Check whether T inherits from _CONCEPT_ M. */ template <typename T, template <class> class M> struct is_a : bool_<( sizeof( internal::helper_is_a_< T, M >::selector(internal::make_< T >::ptr()) ) //**ERROR** == sizeof( internal::yes_ ) )> {}; 

This is a very short piece of code, but I don't know where the error might come from. Any ideas? Thank you

NOTES:

The definition of interanl::make_<T>::ptr() as follows:

  template <typename T> inline T* make_<T>::ptr() // This piece of code is defined to prevent an ICE from g++-2.95. { T* tmp; return tmp; } template <typename T> struct make_ { static T* ptr(); }; 

The definition of iternal::helper_is_a_ is

  template <typename T, template <class> class M> struct helper_is_a_ { template<class V> static yes_ selector(M<V>*); static no_ selector(...); }; 
+6
source share
1 answer

This will work (tested with vs2008).

 template <typename T, template <class> class M> struct is_a { static const bool value = bool_<( sizeof( internal::helper_is_a_< T, M >::selector(internal::make_< T >::ptr()) ) == sizeof( internal::yes_ ) )>::value; }; 

For some reason, he tries to immediately evaluate sizeof when he sees it as a base class or member. Your source code is compiled using VS2013 C ++ 11.

0
source

All Articles