This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

help with - error: no matching function for call...


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 */



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]