--- Comment #4 from schwab at suse dot de 2008-08-07 15:19 ---
Because the result of FooBar("two") is an rvalue, but test1 is an lvalue.
--
schwab at suse dot de changed:
What|Removed |Added
-
--- Comment #3 from scott at stg dot net 2008-08-07 13:53 ---
For clarification, this code compiles & runs in gcc & msvc:
FooBar test1("one");
"A">>test1;
And this code compiles & runs fine in msvc, but gives compile error in gcc:
"B">>FooBar("two");
Since it's
--- Comment #2 from scott at stg dot net 2008-08-07 13:31 ---
Okay, so if I change:
FooBar& operator>> (const char *s,FooBar& dest)
to
FooBar operator>> (const char *s,FooBar dest)
It now compiles on both msvc and g++, but required functionality (operation
affecting existing object,
--- Comment #1 from pinskia at gcc dot gnu dot org 2008-08-06 22:13 ---
You cannot bind a rvalue to a reference, only a constant reference or to a non
reference.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37043