This is the mail archive of the gcc-prs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

c++/9740: Object included in another is not initialized properly


>Number:         9740
>Category:       c++
>Synopsis:       Object included in another is not initialized properly
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Feb 18 11:06:01 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:     Eviatar Tron
>Release:        3.2.2
>Organization:
>Environment:
Configured with: ./configure
Thread model: posix
>Description:
I have an object a of class A which has a memeber from another class B.

the A constructor includes a statment to zero it's memebrs
when the B constructor is called, it trashes the a object,
so that those members are not zero, but some random value.


>How-To-Repeat:
compile the file using g++ -g 
when run, it prints the value of a.p at the
construction, and after the construction
>Fix:
I tried working with pointers as well, but didnt succeed

>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: application/octet-stream; name="test.cpp"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="test.cpp"

I2luY2x1ZGUgPGlvc3RyZWFtLmg+CgpjbGFzcyBBIHsKICBpbnQgaTsKICBpbnQgcDsKcHVibGlj
OgogIEEoKSB7QSgwKTsgfTsKICBBKGludCBqKSB7aT1qOyBwPTA7IGNvdXQgPDwgImluIEEgY29u
c3R1Y3RvcjpcbnA9IiA8PCBwIDw8IGVuZGw7fTsKICBpbnQgZ2V0cCgpIHsgcmV0dXJuIHA7IH07
Cn07CgpjbGFzcyBCIHsKCiAgaW50IHgseSx6OwogIEEgYTsKcHVibGljOgogIEIoKSB7IHg9MTsg
eT0yOyB6PTM7IH0KICBCKGludCBwLGludCBxLCBpbnQgdCkgeyB4PXA7IHk9cTsgej10OyB9Owog
IGludCBydW4oKSB7IGNvdXQgPDwgImFmdGVyIGNyZWF0aW9uOlxucD0iIDw8IGEuZ2V0cCgpIDw8
ZW5kbDt9OyAKfTsKICAKCm1haW4oKQp7CiAgQiBiMTsKICBiMS5ydW4oKTsKICAgIAp9Cg==


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]