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

gadniomaina at yahoo dot com gcc-bugzilla@gcc.gnu.org
Thu Jul 7 11:42:00 GMT 2005


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



More information about the Gcc-bugs mailing list