This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Temporaries
- To: linguist-gcc at rich-paul dot net, gcc at gcc dot gnu dot org
- Subject: Re: Temporaries
- From: Joe Buck <jbuck at racerx dot synopsys dot com>
- Date: Sun, 28 May 2000 17:14:05 -0700 (PDT)
I need to correct a typo in my original message.
> > I'm attempting to port some code that has the following definitions:
> > --------------------- cut here ---------------
> > class Set {
> > public:
> > Set &operator |= ( Set & );
> > Set &operator | ( Set & );
> > };
> > Set &Set::operator | ( Set &rhs ) {
> > return Set(rhs)|=lhs;
> > };
> > --------------------- cut here ---------------
>
> This is not legal C++.
>
> > Under visual c++, this is fine,
>
> Actually it may not be fine under C++ ("compiles" != "fine"). That is,
I meant to write "under Visual C++" ^ here.
> the code in question is likely to have strange bugs, as you are trying to
> create a reference to a temporary which is on a portion of the stack that
> is popped.