Commit e93ee644 by Mark Mitchell Committed by Mark Mitchell

call.c (build_over_call): Use DECL_CONTEXT, not DECL_VIRTUAL_CONTEXT.

	* call.c (build_over_call): Use DECL_CONTEXT, not
	DECL_VIRTUAL_CONTEXT.
	* class.c (modify_vtable_entry): Don't mess with
	DECL_VIRTUAL_CONTEXT.
	(set_vindex): Remove.
	(set_primary_base): Remove vfuns_p parameter.
	(determine_primary_base): Likewise.
	(modify_all_vtables): Likewise.
	(layout_class_type): Likewise.  Adjust calls to other functions
	accordingly.
	(finish_struct_1): Adjust calls to modified functions.  Set
	DECL_VINDEX here.
	* cp-tree.h (lang_type_class): Remove vsize.
	(CLASSTYPE_VSIZE): Remove.
	(lang_decl): Remove thunks.
	(DECL_THUNKS): Adjust.
	(DECL_VIRTUAL_CONTEXT): Remove.
	(duplicate_decls): Don't copy it.
	* pt.c (build_template_decl): Don't set it.
	(tsubst_decl): Likewise.
	* typeck.c (expand_ptrmemfunc_cst): Don't use it.

	* g++.dg/lookup/ptrmem1.C: New test.

From-SVN: r58548
parent 0fb53e68
...@@ -6,6 +6,28 @@ ...@@ -6,6 +6,28 @@
2002-10-25 Mark Mitchell <mark@codesourcery.com> 2002-10-25 Mark Mitchell <mark@codesourcery.com>
* call.c (build_over_call): Use DECL_CONTEXT, not
DECL_VIRTUAL_CONTEXT.
* class.c (modify_vtable_entry): Don't mess with
DECL_VIRTUAL_CONTEXT.
(set_vindex): Remove.
(set_primary_base): Remove vfuns_p parameter.
(determine_primary_base): Likewise.
(modify_all_vtables): Likewise.
(layout_class_type): Likewise. Adjust calls to other functions
accordingly.
(finish_struct_1): Adjust calls to modified functions. Set
DECL_VINDEX here.
* cp-tree.h (lang_type_class): Remove vsize.
(CLASSTYPE_VSIZE): Remove.
(lang_decl): Remove thunks.
(DECL_THUNKS): Adjust.
(DECL_VIRTUAL_CONTEXT): Remove.
(duplicate_decls): Don't copy it.
* pt.c (build_template_decl): Don't set it.
(tsubst_decl): Likewise.
* typeck.c (expand_ptrmemfunc_cst): Don't use it.
* class.c (build_vtbl_initializer): Don't use build_vtable_entry. * class.c (build_vtbl_initializer): Don't use build_vtable_entry.
(build_vtable_entry): Remove. (build_vtable_entry): Remove.
* cp-tree.h (BINFO_VIRTUALS): Expand documentation. * cp-tree.h (BINFO_VIRTUALS): Expand documentation.
......
...@@ -4507,7 +4507,7 @@ build_over_call (cand, args, flags) ...@@ -4507,7 +4507,7 @@ build_over_call (cand, args, flags)
{ {
tree t, *p = &TREE_VALUE (converted_args); tree t, *p = &TREE_VALUE (converted_args);
tree binfo = lookup_base (TREE_TYPE (TREE_TYPE (*p)), tree binfo = lookup_base (TREE_TYPE (TREE_TYPE (*p)),
DECL_VIRTUAL_CONTEXT (fn), DECL_CONTEXT (fn),
ba_any, NULL); ba_any, NULL);
my_friendly_assert (binfo && binfo != error_mark_node, 20010730); my_friendly_assert (binfo && binfo != error_mark_node, 20010730);
......
...@@ -116,8 +116,8 @@ static int alter_access PARAMS ((tree, tree, tree)); ...@@ -116,8 +116,8 @@ static int alter_access PARAMS ((tree, tree, tree));
static void handle_using_decl PARAMS ((tree, tree)); static void handle_using_decl PARAMS ((tree, tree));
static void check_for_override PARAMS ((tree, tree)); static void check_for_override PARAMS ((tree, tree));
static tree dfs_modify_vtables PARAMS ((tree, void *)); static tree dfs_modify_vtables PARAMS ((tree, void *));
static tree modify_all_vtables PARAMS ((tree, int *, tree)); static tree modify_all_vtables PARAMS ((tree, tree));
static void determine_primary_base PARAMS ((tree, int *)); static void determine_primary_base PARAMS ((tree));
static void finish_struct_methods PARAMS ((tree)); static void finish_struct_methods PARAMS ((tree));
static void maybe_warn_about_overly_private_class PARAMS ((tree)); static void maybe_warn_about_overly_private_class PARAMS ((tree));
static int field_decl_cmp PARAMS ((const tree *, const tree *)); static int field_decl_cmp PARAMS ((const tree *, const tree *));
...@@ -142,10 +142,10 @@ static void check_bases PARAMS ((tree, int *, int *, int *)); ...@@ -142,10 +142,10 @@ static void check_bases PARAMS ((tree, int *, int *, int *));
static void check_bases_and_members (tree); static void check_bases_and_members (tree);
static tree create_vtable_ptr (tree, tree *); static tree create_vtable_ptr (tree, tree *);
static void include_empty_classes (record_layout_info); static void include_empty_classes (record_layout_info);
static void layout_class_type (tree, int *, tree *); static void layout_class_type (tree, tree *);
static void fixup_pending_inline PARAMS ((tree)); static void fixup_pending_inline PARAMS ((tree));
static void fixup_inline_methods PARAMS ((tree)); static void fixup_inline_methods PARAMS ((tree));
static void set_primary_base PARAMS ((tree, tree, int *)); static void set_primary_base PARAMS ((tree, tree));
static void propagate_binfo_offsets PARAMS ((tree, tree, tree)); static void propagate_binfo_offsets PARAMS ((tree, tree, tree));
static void layout_virtual_bases (record_layout_info, splay_tree); static void layout_virtual_bases (record_layout_info, splay_tree);
static tree dfs_set_offset_for_unshared_vbases PARAMS ((tree, void *)); static tree dfs_set_offset_for_unshared_vbases PARAMS ((tree, void *));
...@@ -173,7 +173,6 @@ static bool layout_empty_base PARAMS ((tree, tree, splay_tree, tree)); ...@@ -173,7 +173,6 @@ static bool layout_empty_base PARAMS ((tree, tree, splay_tree, tree));
static void accumulate_vtbl_inits PARAMS ((tree, tree, tree, tree, tree)); static void accumulate_vtbl_inits PARAMS ((tree, tree, tree, tree, tree));
static tree dfs_accumulate_vtbl_inits PARAMS ((tree, tree, tree, tree, static tree dfs_accumulate_vtbl_inits PARAMS ((tree, tree, tree, tree,
tree)); tree));
static void set_vindex PARAMS ((tree, int *));
static void build_rtti_vtbl_entries PARAMS ((tree, vtbl_init_data *)); static void build_rtti_vtbl_entries PARAMS ((tree, vtbl_init_data *));
static void build_vcall_and_vbase_vtbl_entries PARAMS ((tree, static void build_vcall_and_vbase_vtbl_entries PARAMS ((tree,
vtbl_init_data *)); vtbl_init_data *));
...@@ -738,37 +737,9 @@ modify_vtable_entry (t, binfo, fndecl, delta, virtuals) ...@@ -738,37 +737,9 @@ modify_vtable_entry (t, binfo, fndecl, delta, virtuals)
BV_DELTA (v) = delta; BV_DELTA (v) = delta;
BV_VCALL_INDEX (v) = NULL_TREE; BV_VCALL_INDEX (v) = NULL_TREE;
BV_FN (v) = fndecl; BV_FN (v) = fndecl;
/* Now assign virtual dispatch information, if unset. We can
dispatch this through any overridden base function.
FIXME this can choose a secondary vtable if the primary is not
also lexically first, leading to useless conversions.
In the V3 ABI, there's no reason for DECL_VIRTUAL_CONTEXT to
ever be different from DECL_CONTEXT. */
if (TREE_CODE (DECL_VINDEX (fndecl)) != INTEGER_CST)
{
DECL_VINDEX (fndecl) = DECL_VINDEX (base_fndecl);
DECL_VIRTUAL_CONTEXT (fndecl) = DECL_VIRTUAL_CONTEXT (base_fndecl);
}
} }
} }
/* Set DECL_VINDEX for DECL. VINDEX_P is the number of virtual
functions present in the vtable so far. */
static void
set_vindex (decl, vfuns_p)
tree decl;
int *vfuns_p;
{
int vindex;
vindex = *vfuns_p;
*vfuns_p += (TARGET_VTABLE_USES_DESCRIPTORS
? TARGET_VTABLE_USES_DESCRIPTORS : 1);
DECL_VINDEX (decl) = build_shared_int_cst (vindex);
}
/* Add method METHOD to class TYPE. If ERROR_P is true, we are adding /* Add method METHOD to class TYPE. If ERROR_P is true, we are adding
the method after the class has already been defined because a the method after the class has already been defined because a
...@@ -1577,10 +1548,9 @@ mark_primary_bases (type) ...@@ -1577,10 +1548,9 @@ mark_primary_bases (type)
/* Make the BINFO the primary base of T. */ /* Make the BINFO the primary base of T. */
static void static void
set_primary_base (t, binfo, vfuns_p) set_primary_base (t, binfo)
tree t; tree t;
tree binfo; tree binfo;
int *vfuns_p;
{ {
tree basetype; tree basetype;
...@@ -1590,15 +1560,13 @@ set_primary_base (t, binfo, vfuns_p) ...@@ -1590,15 +1560,13 @@ set_primary_base (t, binfo, vfuns_p)
TYPE_BINFO_VIRTUALS (t) = TYPE_BINFO_VIRTUALS (basetype); TYPE_BINFO_VIRTUALS (t) = TYPE_BINFO_VIRTUALS (basetype);
TYPE_VFIELD (t) = TYPE_VFIELD (basetype); TYPE_VFIELD (t) = TYPE_VFIELD (basetype);
CLASSTYPE_RTTI (t) = CLASSTYPE_RTTI (basetype); CLASSTYPE_RTTI (t) = CLASSTYPE_RTTI (basetype);
*vfuns_p = CLASSTYPE_VSIZE (basetype);
} }
/* Determine the primary class for T. */ /* Determine the primary class for T. */
static void static void
determine_primary_base (t, vfuns_p) determine_primary_base (t)
tree t; tree t;
int *vfuns_p;
{ {
int i, n_baseclasses = CLASSTYPE_N_BASECLASSES (t); int i, n_baseclasses = CLASSTYPE_N_BASECLASSES (t);
tree vbases; tree vbases;
...@@ -1630,7 +1598,7 @@ determine_primary_base (t, vfuns_p) ...@@ -1630,7 +1598,7 @@ determine_primary_base (t, vfuns_p)
if (!CLASSTYPE_HAS_PRIMARY_BASE_P (t)) if (!CLASSTYPE_HAS_PRIMARY_BASE_P (t))
{ {
set_primary_base (t, base_binfo, vfuns_p); set_primary_base (t, base_binfo);
CLASSTYPE_VFIELDS (t) = copy_list (CLASSTYPE_VFIELDS (basetype)); CLASSTYPE_VFIELDS (t) = copy_list (CLASSTYPE_VFIELDS (basetype));
} }
else else
...@@ -1732,7 +1700,7 @@ determine_primary_base (t, vfuns_p) ...@@ -1732,7 +1700,7 @@ determine_primary_base (t, vfuns_p)
/* If we've got a primary base, use it. */ /* If we've got a primary base, use it. */
if (candidate) if (candidate)
{ {
set_primary_base (t, candidate, vfuns_p); set_primary_base (t, candidate);
CLASSTYPE_VFIELDS (t) CLASSTYPE_VFIELDS (t)
= copy_list (CLASSTYPE_VFIELDS (BINFO_TYPE (candidate))); = copy_list (CLASSTYPE_VFIELDS (BINFO_TYPE (candidate)));
} }
...@@ -2544,9 +2512,8 @@ dfs_modify_vtables (binfo, data) ...@@ -2544,9 +2512,8 @@ dfs_modify_vtables (binfo, data)
should therefore be appended to the end of the vtable for T. */ should therefore be appended to the end of the vtable for T. */
static tree static tree
modify_all_vtables (t, vfuns_p, virtuals) modify_all_vtables (t, virtuals)
tree t; tree t;
int *vfuns_p;
tree virtuals; tree virtuals;
{ {
tree binfo = TYPE_BINFO (t); tree binfo = TYPE_BINFO (t);
...@@ -2570,12 +2537,6 @@ modify_all_vtables (t, vfuns_p, virtuals) ...@@ -2570,12 +2537,6 @@ modify_all_vtables (t, vfuns_p, virtuals)
if (!value_member (fn, BINFO_VIRTUALS (binfo)) if (!value_member (fn, BINFO_VIRTUALS (binfo))
|| DECL_VINDEX (fn) == error_mark_node) || DECL_VINDEX (fn) == error_mark_node)
{ {
/* Set the vtable index. */
set_vindex (fn, vfuns_p);
/* We don't need to convert to a base class when calling
this function. */
DECL_VIRTUAL_CONTEXT (fn) = t;
/* We don't need to adjust the `this' pointer when /* We don't need to adjust the `this' pointer when
calling this function. */ calling this function. */
BV_DELTA (*fnsp) = integer_zero_node; BV_DELTA (*fnsp) = integer_zero_node;
...@@ -2588,7 +2549,7 @@ modify_all_vtables (t, vfuns_p, virtuals) ...@@ -2588,7 +2549,7 @@ modify_all_vtables (t, vfuns_p, virtuals)
/* We've already got an entry for this function. Skip it. */ /* We've already got an entry for this function. Skip it. */
*fnsp = TREE_CHAIN (*fnsp); *fnsp = TREE_CHAIN (*fnsp);
} }
return virtuals; return virtuals;
} }
...@@ -4850,7 +4811,7 @@ include_empty_classes (record_layout_info rli) ...@@ -4850,7 +4811,7 @@ include_empty_classes (record_layout_info rli)
pointer. Accumulate declared virtual functions on VIRTUALS_P. */ pointer. Accumulate declared virtual functions on VIRTUALS_P. */
static void static void
layout_class_type (tree t, int *vfuns_p, tree *virtuals_p) layout_class_type (tree t, tree *virtuals_p)
{ {
tree non_static_data_members; tree non_static_data_members;
tree field; tree field;
...@@ -4874,7 +4835,7 @@ layout_class_type (tree t, int *vfuns_p, tree *virtuals_p) ...@@ -4874,7 +4835,7 @@ layout_class_type (tree t, int *vfuns_p, tree *virtuals_p)
/* If possible, we reuse the virtual function table pointer from one /* If possible, we reuse the virtual function table pointer from one
of our base classes. */ of our base classes. */
determine_primary_base (t, vfuns_p); determine_primary_base (t);
/* Create a pointer to our virtual function table. */ /* Create a pointer to our virtual function table. */
vptr = create_vtable_ptr (t, virtuals_p); vptr = create_vtable_ptr (t, virtuals_p);
...@@ -5145,7 +5106,6 @@ finish_struct_1 (t) ...@@ -5145,7 +5106,6 @@ finish_struct_1 (t)
tree t; tree t;
{ {
tree x; tree x;
int vfuns;
/* A TREE_LIST. The TREE_VALUE of each node is a FUNCTION_DECL. */ /* A TREE_LIST. The TREE_VALUE of each node is a FUNCTION_DECL. */
tree virtuals = NULL_TREE; tree virtuals = NULL_TREE;
int n_fields = 0; int n_fields = 0;
...@@ -5166,7 +5126,6 @@ finish_struct_1 (t) ...@@ -5166,7 +5126,6 @@ finish_struct_1 (t)
TYPE_SIZE (t) = NULL_TREE; TYPE_SIZE (t) = NULL_TREE;
CLASSTYPE_GOT_SEMICOLON (t) = 0; CLASSTYPE_GOT_SEMICOLON (t) = 0;
CLASSTYPE_PRIMARY_BINFO (t) = NULL_TREE; CLASSTYPE_PRIMARY_BINFO (t) = NULL_TREE;
vfuns = 0;
CLASSTYPE_RTTI (t) = NULL_TREE; CLASSTYPE_RTTI (t) = NULL_TREE;
fixup_inline_methods (t); fixup_inline_methods (t);
...@@ -5182,7 +5141,7 @@ finish_struct_1 (t) ...@@ -5182,7 +5141,7 @@ finish_struct_1 (t)
check_bases_and_members (t); check_bases_and_members (t);
/* Layout the class itself. */ /* Layout the class itself. */
layout_class_type (t, &vfuns, &virtuals); layout_class_type (t, &virtuals);
/* Make sure that we get our own copy of the vfield FIELD_DECL. */ /* Make sure that we get our own copy of the vfield FIELD_DECL. */
vfield = TYPE_VFIELD (t); vfield = TYPE_VFIELD (t);
...@@ -5206,7 +5165,7 @@ finish_struct_1 (t) ...@@ -5206,7 +5165,7 @@ finish_struct_1 (t)
else else
my_friendly_assert (!vfield || DECL_FIELD_CONTEXT (vfield) == t, 20010726); my_friendly_assert (!vfield || DECL_FIELD_CONTEXT (vfield) == t, 20010726);
virtuals = modify_all_vtables (t, &vfuns, nreverse (virtuals)); virtuals = modify_all_vtables (t, nreverse (virtuals));
/* If we created a new vtbl pointer for this class, add it to the /* If we created a new vtbl pointer for this class, add it to the
list. */ list. */
...@@ -5246,6 +5205,9 @@ finish_struct_1 (t) ...@@ -5246,6 +5205,9 @@ finish_struct_1 (t)
if (TYPE_CONTAINS_VPTR_P (t)) if (TYPE_CONTAINS_VPTR_P (t))
{ {
int vindex;
tree fn;
if (TYPE_BINFO_VTABLE (t)) if (TYPE_BINFO_VTABLE (t))
my_friendly_assert (DECL_VIRTUAL_P (TYPE_BINFO_VTABLE (t)), my_friendly_assert (DECL_VIRTUAL_P (TYPE_BINFO_VTABLE (t)),
20000116); 20000116);
...@@ -5253,9 +5215,17 @@ finish_struct_1 (t) ...@@ -5253,9 +5215,17 @@ finish_struct_1 (t)
my_friendly_assert (TYPE_BINFO_VIRTUALS (t) == NULL_TREE, my_friendly_assert (TYPE_BINFO_VIRTUALS (t) == NULL_TREE,
20000116); 20000116);
CLASSTYPE_VSIZE (t) = vfuns;
/* Add entries for virtual functions introduced by this class. */ /* Add entries for virtual functions introduced by this class. */
TYPE_BINFO_VIRTUALS (t) = chainon (TYPE_BINFO_VIRTUALS (t), virtuals); TYPE_BINFO_VIRTUALS (t) = chainon (TYPE_BINFO_VIRTUALS (t), virtuals);
/* Set DECL_VINDEX for all functions declared in this class. */
for (vindex = 0, fn = BINFO_VIRTUALS (TYPE_BINFO (t));
fn;
fn = TREE_CHAIN (fn),
vindex += (TARGET_VTABLE_USES_DESCRIPTORS
? TARGET_VTABLE_USES_DESCRIPTORS : 1))
if (TREE_CODE (DECL_VINDEX (BV_FN (fn))) != INTEGER_CST)
DECL_VINDEX (BV_FN (fn)) = build_shared_int_cst (vindex);
} }
finish_struct_bits (t); finish_struct_bits (t);
......
...@@ -1150,8 +1150,6 @@ struct lang_type_class GTY(()) ...@@ -1150,8 +1150,6 @@ struct lang_type_class GTY(())
remove a flag. */ remove a flag. */
unsigned dummy : 4; unsigned dummy : 4;
int vsize;
tree primary_base; tree primary_base;
tree vfields; tree vfields;
tree vbases; tree vbases;
...@@ -1375,10 +1373,6 @@ struct lang_type GTY(()) ...@@ -1375,10 +1373,6 @@ struct lang_type GTY(())
#define CLASSTYPE_PRIMARY_BINFO(NODE) \ #define CLASSTYPE_PRIMARY_BINFO(NODE) \
(LANG_TYPE_CLASS_CHECK (NODE)->primary_base) (LANG_TYPE_CLASS_CHECK (NODE)->primary_base)
/* The number of virtual functions present in this class' virtual
function table. */
#define CLASSTYPE_VSIZE(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->vsize)
/* A chain of BINFOs for the direct and indirect virtual base classes /* A chain of BINFOs for the direct and indirect virtual base classes
that this type uses in a post-order depth-first left-to-right that this type uses in a post-order depth-first left-to-right
order. (In other words, these bases appear in the order that they order. (In other words, these bases appear in the order that they
...@@ -1766,13 +1760,10 @@ struct lang_decl GTY(()) ...@@ -1766,13 +1760,10 @@ struct lang_decl GTY(())
{ {
tree befriending_classes; tree befriending_classes;
/* For a virtual FUNCTION_DECL, this is DECL_VIRTUAL_CONTEXT. For a /* For a non-virtual FUNCTION_DECL, this is
non-virtual FUNCTION_DECL, this is DECL_FRIEND_CONTEXT. */ DECL_FRIEND_CONTEXT. For a virtual FUNCTION_DECL for which
DECL_THUNK_P does not hold, this is DECL_THUNKS. */
tree context; tree context;
/* In a FUNCTION_DECL for which DECL_THUNK_P does not hold, this
is DECL_THUNKS. */
tree thunks;
/* In a FUNCTION_DECL, this is DECL_CLONED_FUNCTION. */ /* In a FUNCTION_DECL, this is DECL_CLONED_FUNCTION. */
tree cloned_function; tree cloned_function;
...@@ -2060,7 +2051,7 @@ struct lang_decl GTY(()) ...@@ -2060,7 +2051,7 @@ struct lang_decl GTY(())
/* The thunks associated with NODE, a FUNCTION_DECL that is not itself /* The thunks associated with NODE, a FUNCTION_DECL that is not itself
a thunk. */ a thunk. */
#define DECL_THUNKS(NODE) \ #define DECL_THUNKS(NODE) \
(DECL_LANG_SPECIFIC (NODE)->u.f.thunks) (DECL_LANG_SPECIFIC (NODE)->u.f.context)
/* Nonzero if NODE is a thunk, rather than an ordinary function. */ /* Nonzero if NODE is a thunk, rather than an ordinary function. */
#define DECL_THUNK_P(NODE) \ #define DECL_THUNK_P(NODE) \
...@@ -2114,11 +2105,6 @@ struct lang_decl GTY(()) ...@@ -2114,11 +2105,6 @@ struct lang_decl GTY(())
(DECL_CONTEXT (NODE) ? DECL_CONTEXT (NODE) : global_namespace) (DECL_CONTEXT (NODE) ? DECL_CONTEXT (NODE) : global_namespace)
#define FROB_CONTEXT(NODE) ((NODE) == global_namespace ? NULL_TREE : (NODE)) #define FROB_CONTEXT(NODE) ((NODE) == global_namespace ? NULL_TREE : (NODE))
/* For a virtual function, the base where we find its vtable entry.
For a non-virtual function, the base where it is defined. */
#define DECL_VIRTUAL_CONTEXT(NODE) \
(DECL_LANG_SPECIFIC (NODE)->u.f.context)
/* 1 iff NODE has namespace scope, including the global namespace. */ /* 1 iff NODE has namespace scope, including the global namespace. */
#define DECL_NAMESPACE_SCOPE_P(NODE) \ #define DECL_NAMESPACE_SCOPE_P(NODE) \
(!DECL_TEMPLATE_PARM_P (NODE) \ (!DECL_TEMPLATE_PARM_P (NODE) \
......
...@@ -3374,8 +3374,6 @@ duplicate_decls (newdecl, olddecl) ...@@ -3374,8 +3374,6 @@ duplicate_decls (newdecl, olddecl)
definition. */ definition. */
if (DECL_VINDEX (olddecl)) if (DECL_VINDEX (olddecl))
DECL_VINDEX (newdecl) = DECL_VINDEX (olddecl); DECL_VINDEX (newdecl) = DECL_VINDEX (olddecl);
if (DECL_VIRTUAL_CONTEXT (olddecl))
DECL_VIRTUAL_CONTEXT (newdecl) = DECL_VIRTUAL_CONTEXT (olddecl);
if (DECL_CONTEXT (olddecl)) if (DECL_CONTEXT (olddecl))
DECL_CONTEXT (newdecl) = DECL_CONTEXT (olddecl); DECL_CONTEXT (newdecl) = DECL_CONTEXT (olddecl);
DECL_STATIC_CONSTRUCTOR (newdecl) |= DECL_STATIC_CONSTRUCTOR (olddecl); DECL_STATIC_CONSTRUCTOR (newdecl) |= DECL_STATIC_CONSTRUCTOR (olddecl);
...@@ -3412,12 +3410,9 @@ duplicate_decls (newdecl, olddecl) ...@@ -3412,12 +3410,9 @@ duplicate_decls (newdecl, olddecl)
if (newtype != error_mark_node && oldtype != error_mark_node if (newtype != error_mark_node && oldtype != error_mark_node
&& TYPE_LANG_SPECIFIC (newtype) && TYPE_LANG_SPECIFIC (oldtype)) && TYPE_LANG_SPECIFIC (newtype) && TYPE_LANG_SPECIFIC (oldtype))
{ CLASSTYPE_FRIEND_CLASSES (newtype)
CLASSTYPE_VSIZE (newtype) = CLASSTYPE_VSIZE (oldtype); = CLASSTYPE_FRIEND_CLASSES (oldtype);
CLASSTYPE_FRIEND_CLASSES (newtype) \
= CLASSTYPE_FRIEND_CLASSES (oldtype);
}
DECL_ORIGINAL_TYPE (newdecl) = DECL_ORIGINAL_TYPE (olddecl); DECL_ORIGINAL_TYPE (newdecl) = DECL_ORIGINAL_TYPE (olddecl);
} }
......
...@@ -2106,8 +2106,6 @@ build_template_decl (decl, parms) ...@@ -2106,8 +2106,6 @@ build_template_decl (decl, parms)
DECL_CONTEXT (tmpl) = DECL_CONTEXT (decl); DECL_CONTEXT (tmpl) = DECL_CONTEXT (decl);
if (DECL_LANG_SPECIFIC (decl)) if (DECL_LANG_SPECIFIC (decl))
{ {
if (CAN_HAVE_FULL_LANG_DECL_P (decl))
DECL_VIRTUAL_CONTEXT (tmpl) = DECL_VIRTUAL_CONTEXT (decl);
DECL_STATIC_FUNCTION_P (tmpl) = DECL_STATIC_FUNCTION_P (decl); DECL_STATIC_FUNCTION_P (tmpl) = DECL_STATIC_FUNCTION_P (decl);
DECL_CONSTRUCTOR_P (tmpl) = DECL_CONSTRUCTOR_P (decl); DECL_CONSTRUCTOR_P (tmpl) = DECL_CONSTRUCTOR_P (decl);
DECL_DESTRUCTOR_P (tmpl) = DECL_DESTRUCTOR_P (decl); DECL_DESTRUCTOR_P (tmpl) = DECL_DESTRUCTOR_P (decl);
...@@ -5777,10 +5775,6 @@ tsubst_decl (t, args, type, complain) ...@@ -5777,10 +5775,6 @@ tsubst_decl (t, args, type, complain)
= tsubst_aggr_type (DECL_CONTEXT (t), args, = tsubst_aggr_type (DECL_CONTEXT (t), args,
complain, in_decl, complain, in_decl,
/*entering_scope=*/1); /*entering_scope=*/1);
DECL_VIRTUAL_CONTEXT (r)
= tsubst_aggr_type (DECL_VIRTUAL_CONTEXT (t), args,
complain, in_decl,
/*entering_scope=*/1);
DECL_TEMPLATE_INFO (r) = build_tree_list (t, args); DECL_TEMPLATE_INFO (r) = build_tree_list (t, args);
if (TREE_CODE (decl) == TYPE_DECL) if (TREE_CODE (decl) == TYPE_DECL)
...@@ -5951,10 +5945,6 @@ tsubst_decl (t, args, type, complain) ...@@ -5951,10 +5945,6 @@ tsubst_decl (t, args, type, complain)
SET_DECL_RTL (r, NULL_RTX); SET_DECL_RTL (r, NULL_RTX);
DECL_CONTEXT (r) = ctx; DECL_CONTEXT (r) = ctx;
DECL_VIRTUAL_CONTEXT (r)
= tsubst_aggr_type (DECL_VIRTUAL_CONTEXT (t), args,
complain, t,
/*entering_scope=*/1);
if (member && DECL_CONV_FN_P (r)) if (member && DECL_CONV_FN_P (r))
/* Type-conversion operator. Reconstruct the name, in /* Type-conversion operator. Reconstruct the name, in
......
...@@ -5695,7 +5695,7 @@ expand_ptrmemfunc_cst (cst, delta, pfn) ...@@ -5695,7 +5695,7 @@ expand_ptrmemfunc_cst (cst, delta, pfn)
/* If we're dealing with a virtual function, we have to adjust 'this' /* If we're dealing with a virtual function, we have to adjust 'this'
again, to point to the base which provides the vtable entry for again, to point to the base which provides the vtable entry for
fn; the call will do the opposite adjustment. */ fn; the call will do the opposite adjustment. */
tree orig_class = DECL_VIRTUAL_CONTEXT (fn); tree orig_class = DECL_CONTEXT (fn);
tree binfo = binfo_or_else (orig_class, fn_class); tree binfo = binfo_or_else (orig_class, fn_class);
*delta = fold (build (PLUS_EXPR, TREE_TYPE (*delta), *delta = fold (build (PLUS_EXPR, TREE_TYPE (*delta),
*delta, BINFO_OFFSET (binfo))); *delta, BINFO_OFFSET (binfo)));
......
...@@ -4,6 +4,8 @@ ...@@ -4,6 +4,8 @@
2002-10-25 Mark Mitchell <mark@codesourcery.com> 2002-10-25 Mark Mitchell <mark@codesourcery.com>
* g++.dg/lookup/ptrmem1.C: New test.
* g++.dg/abi/vthunk2.C: New test. * g++.dg/abi/vthunk2.C: New test.
2002-10-25 Zack Weinberg <zack@codesourcery.com> 2002-10-25 Zack Weinberg <zack@codesourcery.com>
......
struct A {
virtual void f ();
};
struct B : public A {
};
struct C : public A {
};
struct D : public B, C {
virtual void f ();
};
void (D::*p)() = &D::f;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment