This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Can't match void parameters for empty parms in ptr-mem-functions.
- To: gcc <gcc at gcc dot gnu dot org>
- Subject: Can't match void parameters for empty parms in ptr-mem-functions.
- From: Benjamin Scherrey <scherrey at switchco dot com>
- Date: Thu, 24 Feb 2000 03:43:00 -0500
- Organization: Proteus Technologies, Inc.
- Reply-To: scherrey at proteus-tech dot com
Attached is a small sample program that demonstrates a problem I'm
having. I'm running gcc-2.95.2 under ix86/Linux (RedHat 6.1). I'm
trying to instantiate a template class instance that takes as a
parameter in its constructor, a pointer to a member function that is
described by the template parameters. If that member function takes a
non-void parameter then everything's fine. If it doesn't take a
parameter, however, the compiler fails to resolve this empty parm as a
void parm.
Any ideas?
Ben Scherrey
//
// match.cpp - Tests pointer to memberfunction void parm resolution problem.
//
template < class To, typename ReturnType, typename ParmType >
class Matcher
{
public:
typedef ReturnType (To::*SendMethod)(ParmType) const;
typedef ReturnType (To::*EmptyMethod)() const;
// This constructor can't match void parm SendMethods.
Matcher( const To& t, const SendMethod sm )
{
}
// This constructor will work, however!
/*
Matcher( const To& t, const EmptyMethod em )
{
}
*/
};
class Test
{
public:
bool testVoid( void ) const { return 0; }
bool testInt( int ) const { return 0; }
};
int main( void )
{
Test ATest;
Matcher< Test, bool, void > M1( ATest, &Test::testVoid );
Matcher< Test, bool, int > M2( ATest, &Test::testInt );
}
// eof( match.cpp )