[gnu.g++.bug] null pointers to members

jjc@UUNET.UU.NET (James Clark) (09/05/89)

cfront guarantees that a valid pointer to member is not equal to zero
(it adds 1 to the offset); g++ 1.35.1- doesn't:

Script started on Tue Sep  5 08:55:32 1989
$ cat test.c
#include <stdio.h>

struct A {
  int n;
};

main()
{
  auto A::*ptr = &A::n;
  if (ptr == 0)
    puts("zero pointer to member");
}
$ g++ -g -v test.c
g++ version 1.35.1-
 /usr/local/lib/gcc-cpp -+ -v -undef -D__GNU__ -D__GNUG__ -D__cplusplus -Dsparc -Dsun -Dunix -D__sparc__ -D__sun__ -D__unix__ test.c /tmp/cca04660.cpp
GNU CPP version 1.35
 /usr/local/lib/gcc-cc1plus /tmp/cca04660.cpp -quiet -dumpbase test.c -noreg -version -G -o /tmp/cca04660.s
GNU C++ version 1.35.1- (sparc) compiled by GNU C version 1.35.
 /usr/local/lib/gcc-as /tmp/cca04660.s -o test.o
 /usr/local/lib/gcc-ld++ -C /usr/local/lib/crt0+.o test.o -lg++ /usr/local/lib/gcc-gnulib -lg -lc
$ a.out
zero pointer to member
$ 

script done on Tue Sep  5 08:55:53 1989

James Clark
jjc@jclark.uucp