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]

Is this a bug in egcs or is it egcs better adherence to the standard.


The following code:
main.C
--
#include "dataengine/Abstract.H"
#include "modelling/PointSet.H"

void 
f(void)
{
  mdlC_PointSet pointSet;
  deC_Abstract<mdlC_PointSetR> pointSetR(pointSet);
  geoS_Point newPoint(0, 0, 0);
  newPoint = pointSetR->P[0];
}

int
main(void)
{
  return 0;
}
--
compiles fine under gcc 2.7.2.1, MSVC++ 5.0, and SGI's CC V7.2. (Well code 
like this) Under gcc-2.8.* and egcs I get the following message.

dan@gauss[~/compiler-bug]> g++ -DPLATFORM_SGI_IRIX -DOS_MAJOR_6 -DOS_MINOR_2 
-I/maptek/people/dan/carmen/include -I/maptek/people/dan/carmen -c main.C
/maptek/people/dan/carmen/include/geometry_new/Point.H: In function `void 
f()':
/maptek/people/dan/carmen/include/geometry_new/Point.H:364: 
`geoC_PointR::operator geoS_Point() const' is from private base class
main.C:10: within this context

If I cast the result, before assignment to newPoint, it works fine.

The deC_Abstract class has an overloaded -> operator:
--
template< class TYPE >
class deC_Abstract
{
public:
 ...
  TYPE* operator->();
 ...
private:
 ...
  TYPE* myCastPointer;
 ...
};
--
The -> operator returns the private member myCastPointer.

I've included bzip2 compressed output of the preprocessor for anyone who is 
interested. (size about 27K)

main.ii.bz2

Dan Glastonbury <Dan.Glastonbury at maptek.com.au> 
`We gave you an atomic bomb, what do you want, mermaids?'
  -- I. I. Rabi to the Atomic Energy Commission

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