This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
c++/9044: Incorrect error report about constant member not being initialised
- From: jmc at xisl dot com
- To: gcc-gnats at gcc dot gnu dot org
- Date: 23 Dec 2002 20:24:35 -0000
- Subject: c++/9044: Incorrect error report about constant member not being initialised
- Reply-to: jmc at xisl dot com
>Number: 9044
>Category: c++
>Synopsis: Incorrect error report about constant member not being initialised
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Mon Dec 23 12:26:01 PST 2002
>Closed-Date:
>Last-Modified:
>Originator: John Collins
>Release: g++-3.2 (GCC) 3.2 (OK with 2.96)
>Organization:
>Environment:
Mandrake Linux 9.0 3.2-1mdk
>Description:
class class1 {
public:
int fld1;
int fld2;
};
class class2 {
public:
const unsigned type;
int class1::*pmem;
class2(const unsigned t, int class1::*aa) : type(t), pmem(aa) { }
};
class2 inst1(0, &class1::fld1);
class2 inst2(1, &class1::fld2);
Compilation reports error 'uninitialized const member `class2::type' for the last two statements.
Goes away if you remove the "pmem" member.
>How-To-Repeat:
>Fix:
Remove "const" from members in class with pointer to member fields in.
>Release-Note:
>Audit-Trail:
>Unformatted: