This is the mail archive of the gcc-bugs@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++/9355: Base class member not known by derived class constructor's initialization list


>Number:         9355
>Category:       c++
>Synopsis:       Base class member not known by derived class constructor's initialization list
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          rejects-legal
>Submitter-Id:   net
>Arrival-Date:   Fri Jan 17 11:36:00 PST 2003
>Closed-Date:
>Last-Modified:
>Originator:     Piotr Jachowicz
>Release:        gcc version 3.2 20020927 (prerelease)
>Organization:
>Environment:
gcc on cygwin on WinNT SP6
>Description:
del_spr01.cpp: In constructor `B::B()':
del_spr01.cpp:37: class `B' does not have any field named `i'
>How-To-Repeat:
class A {
public:
  int i;
};

class B : public A {
public:
  B() : i(5) {}
};
>Fix:
class A {
public:
  int i;
};

class B : public A {
public:
  B() {i = 5;}
};
>Release-Note:
>Audit-Trail:
>Unformatted:


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