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]

Bug in MI?


Hi,

I'm just looking at a problem  some of my  collegues are having.  It's
actually  quite   a  big   source  file  (around  70000   lines  after
preprocessing) and uses a very complex  inheritance lattice (8 parents
and around 30 ancestors - dammed I'd really appreciat having something
like Source-Navigator around...),  but I've been able  to reduce it to
30 lines.

Compiling  it with all gcc versions  I have around here (2.6.3, 2.7.2,
egcs in various versions), results in messages as follows:

t153.cc: In function `int main()':
t153.cc:29: cannot allocate an object of type `ProtectedTTPBidirectionalData'
t153.cc:29:   since the following virtual functions are abstract:
t153.cc:29:     int ProtectedTTPSourceData::convertAddedPtrToCrossConnectionObjectPointer()

BUT,  there is absolutely _no_  pure virtual function flying around!?!
BTW, SunC++ 4.0.1 dumps  core, while a  pretty old GreenHills compiler
does, what I'd expect:

"t153.cc", line 25: warning: Ambiguous virtual function
        ProtectedTTPSourceData::convertAddedPtrToCrossConnectionObjectPointer()
        and
        ProtectedTTPSinkData::convertAddedPtrToCrossConnectionObjectPointer()
"t153.cc", line 30: warning: Unused variable:  p
"t153.cc", line 30: warning: Ambiguous virtual function
        ProtectedTTPSourceData::convertAddedPtrToCrossConnectionObjectPointer()
        and
        ProtectedTTPSinkData::convertAddedPtrToCrossConnectionObjectPointer()

As long as nobody   tries to use   this ambigous method, it  should be
possible to create an  object, right? At   least, gcc's error  message
here is plain wrong.

I'm far  away from  being a  C++ expert. Can  some  of our C++  GNUrus
(Alexandre, Jason, Mark, Mike) please  comment on this?  Perhaps,  you
already have a patch (or an idea for it;-)

Thanks, manfred

// File: t153.cc
class TerminationPointData
{
public:
  virtual int convertAddedPtrToCrossConnectionObjectPointer ();
};

class ProtectedTTPSourceData
  : virtual public TerminationPointData
{
public:
  virtual int convertAddedPtrToCrossConnectionObjectPointer ();
};

class ProtectedTTPSinkData
  : virtual public TerminationPointData
{
public:
  virtual int convertAddedPtrToCrossConnectionObjectPointer ();
};

class ProtectedTTPBidirectionalData
  : virtual public ProtectedTTPSourceData
  , virtual public ProtectedTTPSinkData
{
};

main ()
{
  TerminationPointData *p = new ProtectedTTPBidirectionalData;
}


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