[Bug c++/13402] New: Wrong default value for uninitialized pointer-to-member

grigory at stl dot sarov dot ru gcc-bugzilla@gcc.gnu.org
Mon Dec 15 15:32:00 GMT 2003


An uninitialized pointer to member field in a file-scope object must be NULL by
default (accordong to the C++ ABI NULL is represented as -1).

G++ compiler fails to provide correct default value for pointer to member field
of a base class. In the simple class hierarchy listed below, p1 is not NULL.

struct A {
    int x;
};

struct B {
    int A::*p1;
};

struct D : B {
};

D obj;


Complete run-time test attached.

-- 
           Summary: Wrong default value for uninitialized pointer-to-member
           Product: gcc
           Version: 3.4
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: grigory at stl dot sarov dot ru
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i686-redhat-linux
  GCC host triplet: i686-redhat-linux
GCC target triplet: i686-redhat-linux


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13402



More information about the Gcc-bugs mailing list