c++/9044: Incorrect error report about constant member not being initialised

jmc@xisl.com jmc@xisl.com
Mon Dec 23 12:26:00 GMT 2002


>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:



More information about the Gcc-bugs mailing list