My appoligies. Dave's code has been accepted by the compiler after I compiled newly installed sources.
- Alona -----Original Message----- From: Alona Rossen Sent: Monday, January 25, 2010 10:58 AM To: '[email protected]' Subject: RE: xerces-c 3.0.1 build fails on HP-UX 11.00 with aCC A.03.35 Hi Dave, The compiler did not accept your solution either. This is how I handled it: BinHTTPInputStreamCommon.hpp: class XMLUTIL_EXPORT BinHTTPInputStreamCommon : public BinInputStream { public : virtual XMLFilePos curPos() const; virtual XMLSize_t readBytes ( XMLByte* const toFill , const XMLSize_t maxToRead ); virtual const XMLCh *getContentType() const{}; virtual const XMLCh *getContentType(); protected : BinHTTPInputStreamCommon(MemoryManager *manager); virtual ~BinHTTPInputStreamCommon(); .......................... .......................... } BinHTTPInputStreamCommon.cpp: const XMLCh *BinHTTPInputStreamCommon::getContentType() { if(fContentType == 0) { // mutable //const_cast<XMLCh*&>(fContentType) = const_cast<BinHTTPInputStreamCommo n*>(this)->findHeader("Content-Type"); fContentType = const_cast<BinHTTPInputStreamCommon*>(this)->findHeader(" Content-Type"); } return fContentType; } There is one derivation from BinHTTPInputStreamCommon: class XMLUTIL_EXPORT UnixHTTPURLInputStream : public BinHTTPInputStreamCommon However, UnixHTTPURLInputStream does not redefine getContentType(). Regards, Alona -----Original Message----- From: David Bertoni [mailto:[email protected]] Sent: Friday, January 22, 2010 6:09 PM To: [email protected] Subject: Re: xerces-c 3.0.1 build fails on HP-UX 11.00 with aCC A.03.35 On 1/22/2010 7:38 AM, Alona Rossen wrote: > Hello, > > I receive the following error when I build xerces-c 3.0.1 with aCC: HP > ANSI C++ B3910B A.03.35: > > Error 742: "xercesc/util/NetAccessors/BinHTTPInputStreamCommon.cpp", > line 260 > # Source type unsigned short *const and target type unsigned short > *& in a > const_cast can only differ in their qualifiers > const_cast<XMLCh*&>(fContentType) = > const_cast<BinHTTPInputStreamCo This is an "interesting" way of modifying a data member in a const member function. Can you try this instead, to see if it works? const_cast<BinHTTPInputStreamCommon*>(this)->fContentType = const_cast<BinHTTPInputStreamCommon*>(this)->findHeader("Content-Type"); We really should just make this data member mutable, since the code as it stands results in undefined behavior. Dave
