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

bangerth@dealii.org bangerth@dealii.org
Wed Feb 19 02:42:00 GMT 2003


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



More information about the Gcc-bugs mailing list