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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux