This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Why does this not compile?
- From: Matthijs van Duin <gcc at nubz dot org>
- To: gcc at gcc dot gnu dot org
- Cc: vharron at soe dot sony dot com, aoliva at redhat dot com
- Date: Mon, 20 May 2002 00:09:57 +0200
- Subject: Re: Why does this not compile?
- References: <1021835697.25496.ezmlm@gcc.gnu.org>
Alexandre Oliva wrote:
>On May 19, 2002, "Harron, Vince" <vharron@soe.sony.com> wrote:
>
> > I've read a lot but I can't seem to find any references on this
>problem. It
> > seems to be a reasonable construct. Why have you decided to forbid this?
>
>Because the C++ Standard says so. You can't bind a temporary to a
>reference to non-const. -fpermissive might get gcc to accept the
>code, but don't count on that from C++ compilers in general.
Or ofcourse he might simply fix the declaration to:
istream& operator>> (istream& is, const binary& b);
it's funny, when I see code of fellow students or even teachers, it
seems that hardly anyone bothers to use const-qualifiers, or
qualifiers in general
Oh well, I guess I'm also the only one to ever have used "explicit"
in a C++ programming assignment ;-)
- xmath
Matthijs van Duin
- PGP Key: 0x2D6F0BA7
- FP: 205D F7BA FFAD 9070 AB9E C5A8 BDB0 CA1B 2D6F 0BA7 -