diff options
Diffstat (limited to 'gcc/cp/class.c')
-rw-r--r-- | gcc/cp/class.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/gcc/cp/class.c b/gcc/cp/class.c index 1a7529e..743ad51 100644 --- a/gcc/cp/class.c +++ b/gcc/cp/class.c @@ -4356,11 +4356,11 @@ check_methods (tree t) for (x = TYPE_METHODS (t); x; x = DECL_CHAIN (x)) { check_for_override (x, t); - if (DECL_PURE_VIRTUAL_P (x) && ! DECL_VINDEX (x)) + if (DECL_PURE_VIRTUAL_P (x) && (TREE_CODE (x) != FUNCTION_DECL || ! DECL_VINDEX (x))) error ("initializer specified for non-virtual method %q+D", x); /* The name of the field is the original field name Save this in auxiliary field for later overloading. */ - if (DECL_VINDEX (x)) + if (TREE_CODE (x) == FUNCTION_DECL && DECL_VINDEX (x)) { TYPE_POLYMORPHIC_P (t) = 1; if (DECL_PURE_VIRTUAL_P (x)) @@ -5658,7 +5658,8 @@ create_vtable_ptr (tree t, tree* virtuals_p) /* Collect the virtual functions declared in T. */ for (fn = TYPE_METHODS (t); fn; fn = DECL_CHAIN (fn)) - if (DECL_VINDEX (fn) && !DECL_MAYBE_IN_CHARGE_DESTRUCTOR_P (fn) + if (TREE_CODE (fn) == FUNCTION_DECL + && DECL_VINDEX (fn) && !DECL_MAYBE_IN_CHARGE_DESTRUCTOR_P (fn) && TREE_CODE (DECL_VINDEX (fn)) != INTEGER_CST) { tree new_virtual = make_node (TREE_LIST); @@ -6327,7 +6328,8 @@ determine_key_method (tree type) this function until the end of the translation unit. */ for (method = TYPE_METHODS (type); method != NULL_TREE; method = DECL_CHAIN (method)) - if (DECL_VINDEX (method) != NULL_TREE + if (TREE_CODE (method) == FUNCTION_DECL + && DECL_VINDEX (method) != NULL_TREE && ! DECL_DECLARED_INLINE_P (method) && ! DECL_PURE_VIRTUAL_P (method)) { @@ -9140,7 +9142,7 @@ add_vcall_offset_vtbl_entries_1 (tree binfo, vtbl_init_data* vid) for (orig_fn = TYPE_METHODS (BINFO_TYPE (binfo)); orig_fn; orig_fn = DECL_CHAIN (orig_fn)) - if (DECL_VINDEX (orig_fn)) + if (TREE_CODE (orig_fn) == FUNCTION_DECL && DECL_VINDEX (orig_fn)) add_vcall_offset (orig_fn, binfo, vid); } |