AW: Re: Bug? access to copy-constructor for operator= needed in gcc-4.0
debian@martin-kittel.de
debian@martin-kittel.de
Mon Jun 13 11:57:00 GMT 2005
>
>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.
More information about the Gcc-help
mailing list