diff options
author | mmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4> | 2000-03-19 05:22:04 +0000 |
---|---|---|
committer | mmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4> | 2000-03-19 05:22:04 +0000 |
commit | ad63a0fca1c16a7b56f4f29888a87ee535cb9f4c (patch) | |
tree | 27221340a82ba130909a03491572338e80e9b132 /gcc/testsuite | |
parent | 562b698d89a7c68dd22d8452a67bd34e4e65871f (diff) | |
download | gcc-ad63a0fca1c16a7b56f4f29888a87ee535cb9f4c.tar.gz |
* cp-tree.h (CLEAR_DECL_C_BIT_FIELD): New macro.
* class.c (check_bitfield_decl): Turn illegal bitfields into
non-bitfields.
(dfs_propagate_binfo_offsets): Adjust for new size_binop
semantics.
(dfs_offset_for_unshared_vbases): Likewise.
* cvt.c (cp_convert_to_pointer): Convert NULL to a
pointer-to-member correctly under the new ABI.
* expr.c (cplus_expand_constant): Don't use cp_convert when
turning an offset into a pointer-to-member.
* init.c (resolve_offset_ref): Don't adjust pointers-to-members
when dereferencing them under the new ABI.
* typeck.c (get_member_function_from_ptrfunc): Tweak calculation
of pointers-to-members under the new ABI.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@32631 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite')
-rw-r--r-- | gcc/testsuite/g++.old-deja/g++.abi/empty.C | 68 | ||||
-rw-r--r-- | gcc/testsuite/g++.old-deja/g++.abi/ptrmem.C | 17 |
2 files changed, 79 insertions, 6 deletions
diff --git a/gcc/testsuite/g++.old-deja/g++.abi/empty.C b/gcc/testsuite/g++.old-deja/g++.abi/empty.C new file mode 100644 index 00000000000..b7a791f0a94 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.abi/empty.C @@ -0,0 +1,68 @@ +// Special g++ Options: -w +// Origin: Mark Mitchell <mark@codesourcery.com> + +#if defined (__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100 + +struct S0 +{ +}; + +struct S1 : public S0 +{ +}; + +struct S2 : public S1 +{ + char c; +}; + +// In S3, the S1 instance is allocated first at offset zero. The S2 +// instance has to be allocated at a subsequent offset; it's first +// part is also an S1. + +struct S3 : public S1, public S2 +{ +}; + +struct S4 +{ + int i; +}; + +// In S4, in contrast to S3, S2 is allocated first, and S1 can be +// allocated on top of S4. + +struct S5 : public S2, public S1, public S4 +{ +}; + +// The T classes are by-hand layouts that should be equivalent to the +// S classes. + +struct T3 +{ + S1 s1; + S2 s2; +}; + +struct T5 +{ + S2 s2; + S4 s4; +}; + +int main () +{ + if (sizeof (S3) != sizeof (T3)) + return 1; + else if (sizeof (S5) != sizeof (T5)) + return 2; +} + +#else /* !(defined (__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100) */ + +int main () +{ +} + +#endif /* !(defined (__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100) */ diff --git a/gcc/testsuite/g++.old-deja/g++.abi/ptrmem.C b/gcc/testsuite/g++.old-deja/g++.abi/ptrmem.C index 8dc3ee46a5c..975d9397ded 100644 --- a/gcc/testsuite/g++.old-deja/g++.abi/ptrmem.C +++ b/gcc/testsuite/g++.old-deja/g++.abi/ptrmem.C @@ -82,16 +82,16 @@ main () if (xp->adj != delta) return 8; - // For a virtual function, we should see twice the vtable index, - // plus one. `T::h' is in the third slot: there's the RTTI entry, - // then the two virtual functions. + // For a virtual function, we should see the vtable offset, plus + // one. `T::h' is in the second slot: the vtable pointer points to + // the first virtual function. y = &T::h; - if ((ptrdiff_t) yp->ptr != 7) + if ((ptrdiff_t) yp->ptr != sizeof (void *) + 1) return 9; if (yp->adj != 0) return 10; x = (sp) y; - if ((ptrdiff_t) xp->ptr != 7) + if ((ptrdiff_t) xp->ptr != sizeof (void *) + 1) return 11; if (xp->adj != delta) return 12; @@ -103,9 +103,14 @@ main () if (__alignof__ (sdp) != __alignof__ (ptrdiff_t)) return 14; + // The value of a pointer-to-data member should be the offset from + // the start of the structure. sdp z = &S::j; - if ((char *) &s.j - (char *) &s != *((ptrdiff_t *) &z) - 1) + if ((char *) &s.j - (char *) &s != *((ptrdiff_t *) &z)) return 15; + z = 0; + if (*((ptrdiff_t *) &z) != -1) + return 16; } #else /* !(defined (__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100) */ |