public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jeroen Wijnhout <Jeroen.Wijnhout@kdemail.net>
To: gcc-help@gcc.gnu.org
Subject: Re: copy ctor not called
Date: Fri, 08 Jul 2005 18:26:00 -0000	[thread overview]
Message-ID: <200507082029.35954.Jeroen.Wijnhout@kdemail.net> (raw)
In-Reply-To: <6.2.1.2.2.20050707070253.028b4e28@iplan-mn.corp.adobe.com>

[-- Attachment #1: Type: text/plain, Size: 951 bytes --]

On Thursday 07 July 2005 02:04 pm, Eljay Love-Jensen wrote:
> Hi Jeroen,
>
> >According to your statement they are wrong.
>
> Please re-read my statement.  My statement does not contradict what you
> cited from C++ Primer.
>
> What is being elided is the assignment operator, not the copy constructor. 
> The copy constructor is still being used for initialization.

Glad to hear that you agree with C++ primer ;-). However, as I found out, the 
default behavior of gcc 3.3.4 is not to call the copy constructor in:
Foo f = 2;
instead it uses direct initialization. I've written a simple test program that 
shows this quite clearly. 

So here the default behavior of gcc contradicts with what I've read in C++ 
primer.

The assigment operator is never called in the statement above, with or without 
-fno-elide-constructors.

See the attached code for an example.

best,
Jeroen
-- 
Kile -- KDE Integrated LaTeX Environment
http://kile.sourceforge.net

[-- Attachment #2: CopyCtor.tar.gz --]
[-- Type: application/x-tgz, Size: 730 bytes --]

      reply	other threads:[~2005-07-08 18:26 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-07-02 18:21 Jeroen Wijnhout
2005-07-02 19:17 ` Travis Spencer
2005-07-03  8:15   ` Jeroen Wijnhout
2005-07-03 12:27 ` Dirk Jagdmann
2005-07-03 13:44   ` Jeroen Wijnhout
2005-07-05 14:10     ` Eljay Love-Jensen
2005-07-07 11:45       ` Jeroen Wijnhout
2005-07-07 12:02       ` Eljay Love-Jensen
2005-07-08 18:26         ` Jeroen Wijnhout [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200507082029.35954.Jeroen.Wijnhout@kdemail.net \
    --to=jeroen.wijnhout@kdemail.net \
    --cc=gcc-help@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).