Re: non-const reference to tem****ary derived from pure virtual Base
by =?ISO-8859-1?Q?Marcel_M=FCller?= <news.5.maazl@[EMAIL PROTECTED]
>
May 6, 2008 at 05:16 PM
reppisch schrieb:
> // not ok!
> u.useBase(Derived(1));
> //* no matching function for call to `User::useBase(Derived)'
> //* candidates are: void User::useBase(Base&)
> // seems that the compiler refuses to make a
> // non-const reference to a tem****ary
Exactly that. Tem****aries are like rvalues.
I had a similar question some time ago (maybe in the german group).
Somebody explained me that this is intended by the standard, because
there are risks otherwise.
You must create a non-tem****ary object for this purpuse.
Derived d(1);
u.useBase(d);
Marcel