This is the mail archive of the gcc@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: Why does this not compile?


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 -


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