This is the mail archive of the gcc-bugs@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]

[Bug c++/22343] Override overloaded function problems


------- Additional Comments From gadniomaina at yahoo dot com  2005-07-07 11:42 -------
The compiler always gives an error when it cannot cast the parameter to the type
of the OVERLOADED function. for example, the code
class a
{
 public:
  virtual void bb( unsigned )
  {
  }

  void bb( int )
  {
  }
};

class b: public a
{
 public:
  void bb( unsigned )
  {
  }
};

int main()
{
    b bb;
    bb.bb( -5 );
    return 0;
}
compiles with a warning, but the code:
class a
{
 public:
  virtual void bb( unsigned )
  {
  }

  void bb( pair< int, double> )
  {
  }
};

class b: public a
{
 public:
  void bb( unsigned )
  {
  }
};

int main()
{
    b bb;
    pair< int, double > t;
    bb.bb( t );
    return 0;
}

does NOT compile at all.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22343


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