From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7528 invoked by alias); 19 Feb 2003 02:42:58 -0000 Mailing-List: contact gcc-prs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-prs-owner@gcc.gnu.org Received: (qmail 7508 invoked by uid 48); 19 Feb 2003 02:42:58 -0000 Date: Wed, 19 Feb 2003 02:42:00 -0000 Message-ID: <20030219024258.7507.qmail@sources.redhat.com> To: gcc-bugs@gcc.gnu.org, gcc-prs@gcc.gnu.org, nobody@gcc.gnu.org, tron@eng.tau.ac.il From: bangerth@dealii.org Reply-To: bangerth@dealii.org, gcc-bugs@gcc.gnu.org, gcc-prs@gcc.gnu.org, nobody@gcc.gnu.org, tron@eng.tau.ac.il, gcc-gnats@gcc.gnu.org Subject: Re: c++/9740: Object included in another is not initialized properly X-SW-Source: 2003-02/txt/msg00863.txt.bz2 List-Id: Synopsis: Object included in another is not initialized properly State-Changed-From-To: open->closed State-Changed-By: bangerth State-Changed-When: Wed Feb 19 02:42:58 2003 State-Changed-Why: Reading a good book about C++ might help. What you do here class A { int i; int p; public: ==> A() {A(0); }; A(int j) {i=j; p=0; cout << "in A constuctor:\np=" << p << endl;}; int getp() { return p; }; }; is not redirecting from one constructor to another, but you create an unnamed, temporary object and call its conversion constructor. The object you're presently in in the first constructor is not change, and is left uninitialized. W. http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=9740