public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* AW: Re: Bug? access to copy-constructor for operator= needed in gcc-4.0
@ 2005-06-13 11:57 debian
  2005-06-13 12:17 ` Nathan Sidwell
  0 siblings, 1 reply; 4+ messages in thread
From: debian @ 2005-06-13 11:57 UTC (permalink / raw)
  To: nathan; +Cc: gcc-help

>
>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.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: AW: Re: Bug? access to copy-constructor for operator= needed in gcc-4.0
  2005-06-13 11:57 AW: Re: Bug? access to copy-constructor for operator= needed in gcc-4.0 debian
@ 2005-06-13 12:17 ` Nathan Sidwell
  2005-06-13 13:08   ` Martin Kittel
  0 siblings, 1 reply; 4+ messages in thread
From: Nathan Sidwell @ 2005-06-13 12:17 UTC (permalink / raw)
  To: debian; +Cc: gcc-help

debian@martin-kittel.de wrote:

> 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.

the reference binding occurs in the call to the copy assignment operator.

> 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).

you are ignoring the binding of the copy asignment operator's arguments.

nathan

-- 
Nathan Sidwell    ::   http://www.codesourcery.com   ::     CodeSourcery LLC
nathan@codesourcery.com    ::     http://www.planetfall.pwp.blueyonder.co.uk

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: AW: Re: Bug? access to copy-constructor for operator= needed in gcc-4.0
  2005-06-13 12:17 ` Nathan Sidwell
@ 2005-06-13 13:08   ` Martin Kittel
  2005-06-14  3:31     ` corey taylor
  0 siblings, 1 reply; 4+ messages in thread
From: Martin Kittel @ 2005-06-13 13:08 UTC (permalink / raw)
  To: gcc-help

Nathan Sidwell <nathan <at> codesourcery.com> writes:

> 
> 
> the reference binding occurs in the call to the copy assignment operator.
> 
Of course - I missed that one completely. So while quite counter-intuitive, I
agree with you now.

Thanks for the clarification.

Best wishes,

Martin.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: AW: Re: Bug? access to copy-constructor for operator= needed in gcc-4.0
  2005-06-13 13:08   ` Martin Kittel
@ 2005-06-14  3:31     ` corey taylor
  0 siblings, 0 replies; 4+ messages in thread
From: corey taylor @ 2005-06-14  3:31 UTC (permalink / raw)
  To: Martin Kittel; +Cc: gcc-help

12.2 of the C++ specification provides more details on the use of
temporary objects especially in this instance.

8.5.3 can be one of the hardest to follow sections :)

corey

On 6/13/05, Martin Kittel <debian@martin-kittel.de> wrote:
> Nathan Sidwell <nathan <at> codesourcery.com> writes:
> 
> >
> >
> > the reference binding occurs in the call to the copy assignment operator.
> >
> Of course - I missed that one completely. So while quite counter-intuitive, I
> agree with you now.
> 
> Thanks for the clarification.
> 
> Best wishes,
> 
> Martin.
> 
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2005-06-14  3:31 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-06-13 11:57 AW: Re: Bug? access to copy-constructor for operator= needed in gcc-4.0 debian
2005-06-13 12:17 ` Nathan Sidwell
2005-06-13 13:08   ` Martin Kittel
2005-06-14  3:31     ` corey taylor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).