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]
Other format: [Raw text]

Re: Is this a bug?


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


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