public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Problem with private methods
@ 2002-02-07  8:02 Hultman, Sten
  0 siblings, 0 replies; 2+ messages in thread
From: Hultman, Sten @ 2002-02-07  8:02 UTC (permalink / raw)
  To: 'gcc-help@gcc.gnu.org'

Hi !

I have encountered a problem when turning from aCC to gcc 3.0.3 on
HP-UX11.00.

I enclose a short samle and the error messages.
It works with no problem on aCC.
I can't see why the streambuf methods are private in this context.or anyo 
Greatful for any hint !

Kindest regards
Sten Hultman


THE PROGRAM:

#include <iostream>
using namespace std;

class sockbuf: public streambuf {
public:
                        sockbuf ();
                        sockbuf (const sockbuf&);
  sockbuf&              operator = (const sockbuf&);
  virtual               ~sockbuf ();
};

sockbuf::sockbuf (const sockbuf& sb)
  : streambuf (sb)
{
}

sockbuf& sockbuf::operator = (const sockbuf& sb)
{
  if (this != &sb ) {
    streambuf::operator = (sb);
    this->sockbuf::~sockbuf(); 
  }
  return *this;
}

THE COMPILER MESSAGES:

[49] % g++ -c socktest.C -o socktest.o
/home/jalpman/gnu32/lib/gcc-lib/hppa2.0w-hp-hpux11.00/3.0.3/include/g++/bits
/std_streambuf.h: In
   copy constructor `sockbuf::sockbuf(const sockbuf&)':
/home/jalpman/gnu32/lib/gcc-lib/hppa2.0w-hp-hpux11.00/3.0.3/include/g++/bits
/std_streambuf.h:517: `std::basic_streambuf<_CharT,
   _Traits>::basic_streambuf(const std::basic_streambuf<_CharT, _Traits>&) 
   [with _CharT = char, _Traits = std::char_traits<char>]' is private
socktest.C:17: within this context
/home/jalpman/gnu32/lib/gcc-lib/hppa2.0w-hp-hpux11.00/3.0.3/include/g++/bits
/std_streambuf.h: In
   member function `sockbuf& sockbuf::operator=(const sockbuf&)':
/home/jalpman/gnu32/lib/gcc-lib/hppa2.0w-hp-hpux11.00/3.0.3/include/g++/bits
/std_streambuf.h:520: `std::basic_streambuf<_CharT,
   _Traits>& std::basic_streambuf<_CharT, _Traits>::operator=(const 
   std::basic_streambuf<_CharT, _Traits>&) [with _CharT = char, _Traits = 
   std::char_traits<char>]' is private
socktest.C:24: within this context


COMPARISON WITH aCC:

] % 
[55] % aCC  -c -AA -O -D__hpux__  -I. -I/opt/aCC/include_std  socktest.C -o
socktest.o
[56] % 








This message contains information that may be privileged or confidential and is the property of the Cap Gemini Ernst & Young Group. It is intended only for the person to whom it is addressed. If you are not the intended recipient, you are not authorized to read, print, retain, copy, disseminate, distribute, or use this message or any part thereof. If you receive this message in error, please notify the sender immediately and delete all copies of this message.

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Problem with private methods
@ 2002-02-08 10:36 Reichelt
  0 siblings, 0 replies; 2+ messages in thread
From: Reichelt @ 2002-02-08 10:36 UTC (permalink / raw)
  To: sten.hultman, gcc-help

Hello!

> I have encountered a problem when turning from aCC to gcc 3.0.3 on
> HP-UX11.00.
>
> I enclose a short samle and the error messages.
> It works with no problem on aCC.
> I can't see why the streambuf methods are private in this context.or
> anyo 
> Greatful for any hint !
>
> Kindest regards
> Sten Hultman

It's intentional that the copy-constructor and operator= of streambuf
are private. A look at the streambuf header unveils:

----------------snip here---------------------
#ifdef _GLIBCPP_RESOLVE_LIB_DEFECTS
    // Side effect of DR 50.
    private:
      basic_streambuf(const __streambuf_type&);

      __streambuf_type& 
      operator=(const __streambuf_type&);
#endif
----------------snip here---------------------

The explanation can be found in DR (defect report) 50:
http://gcc.gnu.org/onlinedocs/libstdc++/ext/lwg-defects.html#50

Greetings,
Volker Reichelt


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2002-02-08 18:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-02-07  8:02 Problem with private methods Hultman, Sten
2002-02-08 10:36 Reichelt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).