Branimir Maksimovic wrote:
> On May 7, 3:21 pm, Branimir Maksimovic <bm...@[EMAIL PROTECTED]
> wrote:
>> What about
>> A foo()
>> {
>> A a;
>> return a;}
>>
>> A a;
>> a = foo();
>> Is compiler obliged to call copy constructor?
>
> Err, I mean to construct tem****ary.
Yes, with assignment it would have to create a tem****ary (and BTW
I really hope the 'a = foo();' statement is inside some function
otherwise it would be ill-formed). There are no provisions in the
Standard to allow skipping creating a tem****ary when one would be
required because the expression on the right-hand side of the
assignment operator produces it. The creation of the tem****ary
is only allowed to be skipped in the case of initialising an object
of the same type:
A a = foo();
> It will call copy constructor all right, but
> still gives error that it wants A(A)
Sorry, I don't know what you mean here.
V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask


|