summaryrefslogtreecommitdiff
path: root/gcc/cp/class.c
diff options
context:
space:
mode:
authorbstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4>2013-07-12 08:41:26 +0000
committerbstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4>2013-07-12 08:41:26 +0000
commit7173826daf929b5d925bbb183f1d1e0c4f2e7be8 (patch)
treed5fa37d59785f9f27547b58ef19a4983866c4ff8 /gcc/cp/class.c
parent5ea851c7f59adf0fde5892c34d5059da38ea7dee (diff)
downloadgcc-7173826daf929b5d925bbb183f1d1e0c4f2e7be8.tar.gz
2013-07-12 Basile Starynkevitch <basile@starynkevitch.net>
MELT branch merged with trunk rev 200918 using svnmerge.py git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/melt-branch@200920 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cp/class.c')
-rw-r--r--gcc/cp/class.c28
1 files changed, 25 insertions, 3 deletions
diff --git a/gcc/cp/class.c b/gcc/cp/class.c
index bb2c3fe80e4..e5166324e4c 100644
--- a/gcc/cp/class.c
+++ b/gcc/cp/class.c
@@ -291,9 +291,31 @@ build_base_path (enum tree_code code,
if (code == MINUS_EXPR && v_binfo)
{
if (complain & tf_error)
- error ("cannot convert from base %qT to derived type %qT via "
- "virtual base %qT", BINFO_TYPE (binfo), BINFO_TYPE (d_binfo),
- BINFO_TYPE (v_binfo));
+ {
+ if (SAME_BINFO_TYPE_P (BINFO_TYPE (binfo), BINFO_TYPE (v_binfo)))
+ {
+ if (want_pointer)
+ error ("cannot convert from pointer to base class %qT to "
+ "pointer to derived class %qT because the base is "
+ "virtual", BINFO_TYPE (binfo), BINFO_TYPE (d_binfo));
+ else
+ error ("cannot convert from base class %qT to derived "
+ "class %qT because the base is virtual",
+ BINFO_TYPE (binfo), BINFO_TYPE (d_binfo));
+ }
+ else
+ {
+ if (want_pointer)
+ error ("cannot convert from pointer to base class %qT to "
+ "pointer to derived class %qT via virtual base %qT",
+ BINFO_TYPE (binfo), BINFO_TYPE (d_binfo),
+ BINFO_TYPE (v_binfo));
+ else
+ error ("cannot convert from base class %qT to derived "
+ "class %qT via virtual base %qT", BINFO_TYPE (binfo),
+ BINFO_TYPE (d_binfo), BINFO_TYPE (v_binfo));
+ }
+ }
return error_mark_node;
}