public inbox for gcc-prs@sourceware.org help / color / mirror / Atom feed
From: relf@os2.ru To: gcc-gnats@gcc.gnu.org Subject: c++/6555: Copy constructor is called before the object (being copied) is initialized Date: Sat, 04 May 2002 02:56:00 -0000 [thread overview] Message-ID: <20020504094735.12582.qmail@sources.redhat.com> (raw) >Number: 6555 >Category: c++ >Synopsis: Copy constructor is called before the object (being copied) is initialized >Confidential: no >Severity: serious >Priority: medium >Responsible: unassigned >State: open >Class: wrong-code >Submitter-Id: net >Arrival-Date: Sat May 04 02:56:01 PDT 2002 >Closed-Date: >Last-Modified: >Originator: relf@os2.ru >Release: gcc 3.0.3 >Organization: >Environment: IBM OS/2 Warp 4.52 >Description: In the attached program first used constructor of class A is copy constructor, i.e. copy constructor is called before any class objects are initialized (so it tries to copy uninitialized object). The program prints which constuctor of A is called, and the output look like: Constructor A(const A&) Constructor A(const A&) Constructor A(const A&) Constructor A() >How-To-Repeat: >Fix: >Release-Note: >Audit-Trail: >Unformatted: ----gnatsweb-attachment---- Content-Type: application/octet-stream; name="bug.cpp" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="bug.cpp" I2luY2x1ZGUgPGlvc3RyZWFtPg0KI2luY2x1ZGUgPG1hcD4NCg0KdXNpbmcgbmFtZXNwYWNlIHN0 ZDsNCg0KdGVtcGxhdGUgPGludCBudW0+DQpjbGFzcyBBDQp7DQpwdWJsaWM6DQogICAgaW50IHZh bHVlW251bV07DQogICAgc3RhdGljIEEgdW5pdDsNCg0KICAgIEEoKQ0KICAgIHsNCiAgICAgICAg Y291dCA8PCAiQ29uc3RydWN0b3IgQSgpXG4iOw0KICAgICAgICB2YWx1ZVswXSA9IDE7DQogICAg fQ0KDQogICAgQShjb25zdCBBJiB4KQ0KICAgIHsNCiAgICAgICAgY291dCA8PCAiQ29uc3RydWN0 b3IgQShjb25zdCBBJilcbiI7DQogICAgICAgIHZhbHVlWzBdID0geC52YWx1ZVswXTsNCiAgICB9 DQp9Ow0KDQp0ZW1wbGF0ZSA8aW50IG51bT4NCkE8bnVtPiBBPG51bT46OnVuaXQ7DQoNCmNsYXNz IGNtcEEzDQp7DQpwdWJsaWM6DQogICAgYm9vbCBvcGVyYXRvciAoKSAoY29uc3QgQTwzPiYgeCwg Y29uc3QgQTwzPiYgeSkNCiAgICB7DQogICAgICAgIHJldHVybiB4LnZhbHVlWzBdPD15LnZhbHVl WzBdOw0KICAgIH0NCn07DQoNCmNsYXNzIEINCnsNCnB1YmxpYzoNCiAgICBtYXA8QTwzPixpbnQs Y21wQTM+IHNvbWU7DQogICAgQigpDQogICAgew0KICAgICAgICBzb21lLmluc2VydCggcGFpcjxB PDM+LGludD4oQTwzPjo6dW5pdCw4OCkgKTsNCiAgICB9DQp9Ow0KDQpCIHRlc3Q7DQoNCmludCBt YWluKCkNCnsNCiAgICByZXR1cm4gMDsNCn0NCg==
next reply other threads:[~2002-05-04 9:56 UTC|newest] Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top 2002-05-04 2:56 relf [this message] 2002-05-05 3:56 Max Alekseyev 2002-09-15 4:59 nathan
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=20020504094735.12582.qmail@sources.redhat.com \ --to=relf@os2.ru \ --cc=gcc-gnats@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: linkBe 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).