public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* c++/6556: Copy constructor is called before the object (being copied) is initialized
@ 2002-05-04 2:56 relf
0 siblings, 0 replies; 2+ messages in thread
From: relf @ 2002-05-04 2:56 UTC (permalink / raw)
To: gcc-gnats
>Number: 6556
>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:02 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==
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: c++/6556: Copy constructor is called before the object (being copied) is initialized
@ 2002-05-04 3:33 paolo
0 siblings, 0 replies; 2+ messages in thread
From: paolo @ 2002-05-04 3:33 UTC (permalink / raw)
To: gcc-bugs, gcc-prs, nobody, relf
Synopsis: Copy constructor is called before the object (being copied) is initialized
State-Changed-From-To: open->closed
State-Changed-By: paolo
State-Changed-When: Sat May 4 03:33:29 2002
State-Changed-Why:
Duplicate od c++/6555.
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=6556
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2002-05-04 10:33 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-05-04 2:56 c++/6556: Copy constructor is called before the object (being copied) is initialized relf
2002-05-04 3:33 paolo
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).