aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Mitchell <mmitchel@gcc.gnu.org>2000-02-22 22:47:56 +0000
committerMark Mitchell <mmitchel@gcc.gnu.org>2000-02-22 22:47:56 +0000
commit7bf94db3eb4dbbb29683c5ba0c38c2e690ad9f4f (patch)
treeade9e65152ba9ac6c128ef7e89d7fd84a62f98be
parentfa2e34e8f267ce9944c3ce053b5785368ecbd89f (diff)
downloadgcc-7bf94db3eb4dbbb29683c5ba0c38c2e690ad9f4f.zip
gcc-7bf94db3eb4dbbb29683c5ba0c38c2e690ad9f4f.tar.gz
gcc-7bf94db3eb4dbbb29683c5ba0c38c2e690ad9f4f.tar.bz2
Add data member test
From-SVN: r32108
-rw-r--r--gcc/testsuite/g++.old-deja/g++.abi/ptrmem.C20
1 files changed, 17 insertions, 3 deletions
diff --git a/gcc/testsuite/g++.old-deja/g++.abi/ptrmem.C b/gcc/testsuite/g++.old-deja/g++.abi/ptrmem.C
index 8bf53fd..8dc3ee4 100644
--- a/gcc/testsuite/g++.old-deja/g++.abi/ptrmem.C
+++ b/gcc/testsuite/g++.old-deja/g++.abi/ptrmem.C
@@ -10,6 +10,7 @@
struct S
{
int i;
+ int j;
};
// Because S does not have a VPTR, it will not be a primary base of T,
@@ -37,21 +38,23 @@ struct ptrmemfunc
ptrdiff_t adj;
};
+typedef int S::*sdp;
typedef void (S::*sp)();
typedef void (T::*tp)();
int
main ()
{
+ S s;
T t;
sp x;
tp y;
ptrmemfunc *xp = (ptrmemfunc *) &x;
ptrmemfunc *yp = (ptrmemfunc *) &y;
ptrdiff_t delta = ((char *) &t) - ((char*) (S*) (&t));
-
- // Pointers-to-members should have the same size and alignment as
- // the PTRMEMFUNC type.
+
+ // Pointers-to-function-members should have the same size and
+ // alignment as the PTRMEMFUNC type.
if (sizeof (sp) != sizeof (ptrmemfunc))
return 1;
if (__alignof__ (sp) != __alignof__ (ptrmemfunc))
@@ -92,6 +95,17 @@ main ()
return 11;
if (xp->adj != delta)
return 12;
+
+ // Pointers-to-data-members should have the same size and alignment
+ // as a ptrdiff_t.
+ if (sizeof (sdp) != sizeof (ptrdiff_t))
+ return 13;
+ if (__alignof__ (sdp) != __alignof__ (ptrdiff_t))
+ return 14;
+
+ sdp z = &S::j;
+ if ((char *) &s.j - (char *) &s != *((ptrdiff_t *) &z) - 1)
+ return 15;
}
#else /* !(defined (__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100) */