Mail Archives: djgpp/1998/06/05/07:02:38
From: | gsm77 AT aol DOT com (GSM77)
|
Newsgroups: | comp.os.msdos.djgpp
|
Subject: | Incomprehensible Warning ...
|
Lines: | 50
|
Message-ID: | <1998060509563900.FAA21150@ladder03.news.aol.com>
|
NNTP-Posting-Host: | ladder03.news.aol.com
|
Date: | 05 Jun 1998 09:56:39 GMT
|
Organization: | AOL, http://www.aol.fr
|
To: | djgpp AT delorie DOT com
|
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp
|
Sorry, but i'm French ...
I got this warning :
"initialization of non-const reference `struct X &' from rvalue 'X'
in passing argument 2 of `operator >>(istream &, X &)'"
I don't understand why ...
The program is like this :
=============================
struct X
{
"some junk vars"
friend istream & operator >> ( istream & , X & );
};
struct Y
: public X
{
"some other junk vars"
friend istream & operator >> ( istream & , Y & );
} ;
istream &
operator >> ( istream & f, X & b)
{
"some read on streams "
return f;
}
istream &
operator >> ( istream & f, Y & b)
{
f >> static_cast <X> (b); /* It's on this line
... */
"some read on streams "
return f;
}
=============================
So if you know what does it means, please explain me !
Bye :-(
- Raw text -