AW: Re: Bug? access to copy-constructor for operator= needed in gcc-4.0

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



>
>Martin Kittel wrote:
>
>>         // works fine
>>         A a;
>>         m_a = a;
>
>>         // needs access to copy-constructor, why?
>>         m_a = A();
>
>This is about reference binding of parameters.  8.5.3 says how references are initialized.  in particular, 'a' is a non-temporary lvalue so the reference can be bound directly to it -- no copy ctor required.
>

I am not convinced. 8.5.3 is about reference initialization, while m_a is neither a reference nor are we talking about initialization here. To me, this is just plain assignment.

So, I'd still say A() is plain construction of a temporary, and then according to 5.17 the copy assignment operator of m_a should be called (it is important here that we are not talking about initialization).

Best wishes,

Martin.

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux