aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
authorMark Mitchell <mark@codesourcery.com>2001-02-16 01:24:14 +0000
committerMark Mitchell <mmitchel@gcc.gnu.org>2001-02-16 01:24:14 +0000
commitf1a3f197e1f19c0b439d84d2e3ce11ab21c507a0 (patch)
tree50359c225572ab1cbda6230552673833ccda35b0 /gcc/cp
parente2c094827c86cb0cbf71ba3b16b09541e61502c2 (diff)
downloadgcc-f1a3f197e1f19c0b439d84d2e3ce11ab21c507a0.zip
gcc-f1a3f197e1f19c0b439d84d2e3ce11ab21c507a0.tar.gz
gcc-f1a3f197e1f19c0b439d84d2e3ce11ab21c507a0.tar.bz2
* typeck2.c (build_m_component_ref): Robustify.
From-SVN: r39731
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/ChangeLog4
-rw-r--r--gcc/cp/typeck2.c15
2 files changed, 12 insertions, 7 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index e8119ea..a65b21e 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,7 @@
+2001-02-15 Mark Mitchell <mark@codesourcery.com>
+
+ * typeck2.c (build_m_component_ref): Robustify.
+
2001-02-15 Alexandre Oliva <aoliva@redhat.com>
* friend.c (do_friend): Don't take the nested [template] class
diff --git a/gcc/cp/typeck2.c b/gcc/cp/typeck2.c
index 1538944..3c26b1b 100644
--- a/gcc/cp/typeck2.c
+++ b/gcc/cp/typeck2.c
@@ -1093,6 +1093,10 @@ build_m_component_ref (datum, component)
return build_min_nt (DOTSTAR_EXPR, datum, component);
datum = decay_conversion (datum);
+
+ if (datum == error_mark_node || component == error_mark_node)
+ return error_mark_node;
+
objtype = TYPE_MAIN_VARIANT (TREE_TYPE (datum));
if (TYPE_PTRMEMFUNC_P (TREE_TYPE (component)))
@@ -1100,18 +1104,15 @@ build_m_component_ref (datum, component)
type = TREE_TYPE (TYPE_PTRMEMFUNC_FN_TYPE (TREE_TYPE (component)));
field_type = type;
}
- else
+ else if (TYPE_PTRMEM_P (TREE_TYPE (component)))
{
type = TREE_TYPE (TREE_TYPE (component));
field_type = TREE_TYPE (type);
}
-
- if (datum == error_mark_node || component == error_mark_node)
- return error_mark_node;
-
- if (TREE_CODE (type) != OFFSET_TYPE && TREE_CODE (type) != METHOD_TYPE)
+ else
{
- cp_error ("`%E' cannot be used as a member pointer, since it is of type `%T'", component, type);
+ cp_error ("`%E' cannot be used as a member pointer, since it is of type `%T'",
+ component, TREE_TYPE (component));
return error_mark_node;
}