This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: Is this a bug?
- From: Ritzert at t-online dot de (Michael Ritzert)
- To: Matt Austern <austern at apple dot com>
- Cc: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 10 Sep 2002 08:22:14 +0200
- Subject: Re: Is this a bug?
- References: <2A1686ED-BF81-11D6-967F-00039390D9E0@apple.com>
Just back from a week-long holiday...
Am Dienstag, 3. September 2002 23:07 schrieb Matt Austern:
> On Friday, August 30, 2002, at 02:39 AM, Ritzert@t-online.de wrote:
> > Hi all,
> >
> > Since 2002-08-26 I'm unable to compile STLPort with gcc HEAD. I have
> > stripped down the STLPort code to this small testcase:
> >
> > # cat x.cpp
> > template <class _Tp>
> > inline const _Tp& max(const _Tp& __a, const _Tp& __b)
> > { return __a < __b ? __b : __a; }
> >
> > void append()
> > {
> > const unsigned __old_size = 3;
> > int __n = 7;
> > max(__old_size, static_cast<unsigned>(__n));
> > }
>
> I think the compiler is wrong to complain. It's true that
> static_cast<unsigned>(__n) is an rvalue. However, binding
> a const reference to an rvalue is legal.
Thanks, that's exactly the point I was uncertain about.
Ok, so I will file a bug report with this further reduced testcase shortly:
int main()
{
int bar = 7;
const unsigned& foo = static_cast<unsigned>(bar);
}
Michael