summaryrefslogtreecommitdiffstats
path: root/gcc/cp/typeck.c
diff options
context:
space:
mode:
authornathan <nathan@138bc75d-0d04-0410-961f-82ee72b054a4>2000-11-27 10:55:32 +0000
committernathan <nathan@138bc75d-0d04-0410-961f-82ee72b054a4>2000-11-27 10:55:32 +0000
commit045ed8f8805fe6c4cb3c4ee024739588f0ca4de3 (patch)
treea663502c969fdc01fa746da34280a67ac26c0011 /gcc/cp/typeck.c
parent2a8be21eed666c48c846ef43bb9abad29da23b31 (diff)
downloadppe42-gcc-045ed8f8805fe6c4cb3c4ee024739588f0ca4de3.tar.gz
ppe42-gcc-045ed8f8805fe6c4cb3c4ee024739588f0ca4de3.zip
cp:
* cp-tree.h (binfo_from_vbase): Return the virtual base's binfo. * cvt.c (cp_convert_to_pointer): Add force parameter. Allow conversions via virtual base if forced. (convert_to_pointer_force): Adjust call to cp_convert_to_pointer. (ocp_convert): Likewise. * search.c (binfo_from_vbase): Return the virtual base's binfo. * typeck.c (get_delta_difference): Adjust handling of virtual bases. testsuite: * g++.old-deja/g++.other/ptrmem8.C: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@37791 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cp/typeck.c')
-rw-r--r--gcc/cp/typeck.c26
1 files changed, 15 insertions, 11 deletions
diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c
index d0ca2bbcb28..39f8b54515e 100644
--- a/gcc/cp/typeck.c
+++ b/gcc/cp/typeck.c
@@ -5912,6 +5912,7 @@ get_delta_difference (from, to, force)
{
tree delta = integer_zero_node;
tree binfo;
+ tree virt_binfo;
if (to == from)
return delta;
@@ -5937,11 +5938,12 @@ get_delta_difference (from, to, force)
binfo = get_binfo (to, from, 1);
if (binfo == 0 || binfo == error_mark_node)
return delta;
- if (binfo_from_vbase (binfo))
- {
- binfo = binfo_for_vbase (BINFO_TYPE (binfo), from);
- cp_warning ("pointer to member cast to virtual base `%T' will only work if you are very careful", BINFO_TYPE (binfo));
- }
+ virt_binfo = binfo_from_vbase (binfo);
+
+ if (virt_binfo)
+ cp_warning ("pointer to member cast via virtual base `%T' of `%T' will only work for objects of dynamic type `%T'",
+ BINFO_TYPE (virt_binfo),
+ BINFO_TYPE (BINFO_INHERITANCE_CHAIN (virt_binfo)), from);
delta = BINFO_OFFSET (binfo);
delta = cp_convert (ptrdiff_type_node, delta);
@@ -5950,15 +5952,17 @@ get_delta_difference (from, to, force)
delta);
}
- if (binfo_from_vbase (binfo))
+ virt_binfo = binfo_from_vbase (binfo);
+ if (virt_binfo)
{
if (force)
- {
- cp_warning ("pointer to member cast from virtual base `%T' will only wokr if you are very careful", BINFO_TYPE (binfo));
- }
+ cp_warning ("pointer to member cast via virtual base `%T' of `%T' will only work for objects of dynamic type `%T'",
+ BINFO_TYPE (virt_binfo),
+ BINFO_TYPE (BINFO_INHERITANCE_CHAIN (virt_binfo)), to);
else
- cp_error ("pointer to member conversion from virtual base `%T'",
- BINFO_TYPE (binfo));
+ cp_error ("pointer to member conversion via virtual base `%T' of `%T'",
+ BINFO_TYPE (virt_binfo),
+ BINFO_TYPE (BINFO_INHERITANCE_CHAIN (virt_binfo)));
}
return BINFO_OFFSET (binfo);
OpenPOWER on IntegriCloud