Like Noah, I don’t know why. Unlike Noah, I did not find a suitable solution, but I learned that I was able to compromise the MingW g ++ 4.4.1 compiler (that is, an internal compiler error ). This was simply not a consistent reference to apply as a template and not a template:
#include <iostream> template< class T > class has_apply { template< class U, U u > struct binder {}; template< class U > static double test( U*, binder< void (U::*) ( const double& ), //&U::template apply< 0 > &U::apply >* = 0 ); public: static binder< void (T::*) ( const double& ), &T::template apply< 0 > >* dummy(); static const bool result = sizeof( test( (T*)(0), dummy() ) ); }; class A { public: // template< unsigned n > void apply( const double& ); }; int main() { std::cout << std::boolalpha << has_apply< A >::result << '\n'; return( 0 ); }
Impact on g ++:
C: \ test> g ++ -std = c ++ 98 y.cpp
y.cpp: In instantiation of 'has_apply':
y.cpp: 38: instantiated from here
y.cpp: 24: internal compiler error: in instantiate_type, at cp / class.c: 6303
Please submit a full bug report,
with preprocessed source if appropriate.
See for instructions.
C: \ test> _
Is he...
PS: I would like to post this as a “comment”, since this is not a “response”.
source share