This is actually the intended behavior. The action needs to save a
copy of the argument (hence needing the copy ctor) s.t. it's still
valid even if the original object has been modified or even died (e.g.
the argument may be a temporary object).
If a class supports =, it should probably have a copy ctor too.
Disabling the copy ctor doesn't buy you much, as someone can always
write:
SomeClass x;
x = foo;
as a workaround for
SomeClass x(foo);
If you really, really cannot give SomeClass a copy ctor, it's easy to
define a custom action for your purpose:
ACTION(CopyToArg0, from) { arg0 = *from; }
...
...WillOnce(CopyToArg0(&x));
--
Zhanyong
On May 26, 3:00 am, Zhanyong Wan (λx.x x) <w...@google.com> wrote:
> On Tue, May 25, 2010 at 11:18 AM, Vlad Losev <v...@losev.com> wrote:
> > Hi,