This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
help with - error: no matching function for call...
- From: jdunn at maine dot rr dot com
- To: gcc-help at gcc dot gnu dot org
- Date: Wed, 02 Jun 2004 13:35:35 -0400
- Subject: help with - error: no matching function for call...
- Reply-to: jdunn at maine dot rr dot com
I have a small test app (see below) that I am trying
to compile with g++ 3.2.2 on Linux (RH9) and Cygwin.
When I compile
g++ -c mytest.cpp
I get the following error
mytest.cpp: In constructor `Unit::Unit()':
mytest.cpp:39: error: no matching function for call to `outerException::
outerException(outerException)'
mytest.cpp:20: error: candidates are:
outerException::outerException(outerException&)
NOTE: If I change line 39 from
throw outerException(this, oError);
to the following 2 lines
outerException ex(this, oError);
throw ex;
it compiles.
Thoughts, comments?!?
Thanks
Jim
/* mytest.cpp */
class Base
{
public:
Base();
~Base();
};
class innerException
{
public:
innerException();
~innerException();
};
class outerException
{
public:
outerException(Base *oParent, innerException &oInner);
outerException(outerException &oSource);
~outerException();
};
class Unit : Base
{
public:
Unit();
~Unit() { };
};
Unit::Unit()
{
try
{
int a = 1;
}
catch (innerException &oError)
{
throw outerException(this, oError);
}
}
/* end mytest.cpp */