public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: c++/6555: Copy constructor is called before the object (being copied) is initialized
@ 2002-05-05  3:56 Max Alekseyev
  0 siblings, 0 replies; 3+ messages in thread
From: Max Alekseyev @ 2002-05-05  3:56 UTC (permalink / raw)
  To: nobody; +Cc: gcc-prs

The following reply was made to PR c++/6555; it has been noted by GNATS.

From: "Max Alekseyev" <relf@os2.ru>
To: "nobody@gcc.gnu.org" <nobody@gcc.gnu.org>,
	"gcc-bugs@gcc.gnu.org" <gcc-bugs@gcc.gnu.org>,
	"gcc-prs@gcc.gnu.org" <gcc-prs@gcc.gnu.org>,
	"gcc-gnats@gcc.gnu.org" <gcc-gnats@gcc.gnu.org>
Cc:  
Subject: Re: c++/6555: Copy constructor is called before the object (being copied) is initialized
Date: Mon, 06 May 2002 03:51:14 -0700 (PDT)

 --_=_=_=IMA.BOUNDARY.GVOJ5E138764=_=_=_
 Content-Type: text/plain; charset="koi8-r"
 Content-Transfer-Encoding: 7bit
 
 Hello!
 
 The simplified source that demostrates the bug is attached. 
 
 
 Regards,
 	Max
 
 
 --_=_=_=IMA.BOUNDARY.GVOJ5E138764=_=_=_
 Content-Type: application/octet-stream; name="bug2.cpp"
 Content-Transfer-Encoding: base64
 
 I2luY2x1ZGUgPGlvc3RyZWFtPg0KDQp1c2luZyBuYW1lc3BhY2Ugc3RkOw0KDQp0ZW1wbGF0ZSA8
 aW50IG51bT4NCmNsYXNzIEENCnsNCnB1YmxpYzoNCiAgICBpbnQgdmFsdWVbbnVtXTsNCiAgICBz
 dGF0aWMgQSB1bml0Ow0KDQogICAgQSgpDQogICAgew0KICAgICAgICBjb3V0IDw8ICJDb25zdHJ1
 Y3RvciBBKClcbiI7DQogICAgICAgIHZhbHVlWzBdID0gMTsNCiAgICB9DQoNCiAgICBBKGNvbnN0
 IEEmIHgpDQogICAgew0KICAgICAgICBjb3V0IDw8ICJDb25zdHJ1Y3RvciBBKGNvbnN0IEEmKVxu
 IjsNCiAgICAgICAgdmFsdWVbMF0gPSB4LnZhbHVlWzBdOw0KICAgIH0NCn07DQoNCnRlbXBsYXRl
 IDxpbnQgbnVtPg0KQTxudW0+IEE8bnVtPjo6dW5pdDsNCg0KY2xhc3MgQg0Kew0KcHVibGljOg0K
 ICAgIGludCB0Ow0KICAgIEIoKQ0KICAgIHsNCiAgICAgICAgQTwzPiB0ZW1wKEE8Mz46OnVuaXQp
 Ow0KICAgICAgICB0ID0gdGVtcC52YWx1ZVswXTsNCiAgICB9DQp9Ow0KDQpCIHRlc3Q7DQoNCmlu
 dCBtYWluKCkNCnsNCiAgICByZXR1cm4gMDsNCn0NCg==
 
 --_=_=_=IMA.BOUNDARY.GVOJ5E138764=_=_=_--


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

* Re: c++/6555: Copy constructor is called before the object (being copied) is initialized
@ 2002-09-15  4:59 nathan
  0 siblings, 0 replies; 3+ messages in thread
From: nathan @ 2002-09-15  4:59 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->analyzed
State-Changed-By: nathan
State-Changed-When: Sun Sep 15 04:59:25 2002
State-Changed-Why:
    not a bug, but a QOI issue. I've attached a modified
    test case. See [3/6/2]/2 you have the equivalent of the
    example there, except with implicit template
    instantiations (over which you have no control).
    
    We should try and DTRT here

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=6555


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

* c++/6555: Copy constructor is called before the object (being copied) is initialized
@ 2002-05-04  2:56 relf
  0 siblings, 0 replies; 3+ messages in thread
From: relf @ 2002-05-04  2:56 UTC (permalink / raw)
  To: gcc-gnats


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


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

end of thread, other threads:[~2002-09-15 11:59 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-05-05  3:56 c++/6555: Copy constructor is called before the object (being copied) is initialized Max Alekseyev
  -- strict thread matches above, loose matches on Subject: below --
2002-09-15  4:59 nathan
2002-05-04  2:56 relf

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