From f8d20ee4a41ea7149ac8bd4f78a0316e3ac059b4 Mon Sep 17 00:00:00 2001 From: swagiaal Date: Thu, 4 Nov 2010 20:43:22 +0000 Subject: Fix derived class overload problem. 2010-11-04 Sami Wagiaalla * gdbtypes.h (struct rank): Created subrank. * gdbtypes.c: Initialized subrank for all 'BADNESS' constants. (distance_to_ancestor): New function. (is_ancestor): Use distance_to_ancestor. (is_public_ancestor): Ditto. (sum_ranks): Handle subrank. (compare_ranks): Ditto. (rank_one_type): Subrank base conversions. 2010-11-04 Sami Wagiaalla * gdb.cp/overload.exp: Added test for inheritance overload. * gdb.cp/overload.cc: Ditto. * gdb.cp/oranking.exp: Removed releveant kfails. --- gdb/gdbtypes.h | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'gdb/gdbtypes.h') diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h index 8ce2c82f579..51eb4456e40 100644 --- a/gdb/gdbtypes.h +++ b/gdb/gdbtypes.h @@ -852,7 +852,15 @@ struct vbase /* Struct used to store conversion rankings. */ struct rank { - int rank; + short rank; + + /* When two conversions are of the same type and therefore have the same + rank, subrank is used to differentiate the two. + Eg: Two derived-class-pointer to base-class-pointer conversions would + both have base pointer conversion rank, but the conversion with the + shorter distance to the ancestor is preferable. 'subrank' would be used + to reflect that. */ + short subrank; }; /* Struct used for ranking a function for overload resolution */ -- cgit v1.2.1