+2000-07-09 Nick Duffek <nsd@redhat.com>
+
+ * gdb.c++/misc.cc (class ClassParam, class_param): Define.
+ (use_methods): New function.
+ (main): Call use_methods().
+ * gdb.c++/classes.exp (test_method_param_class): New procedure.
+ (do_tests): Call test_method_param_class.
+
2000-07-09 Nick Duffek <nsd@redhat.com>
* gdb.c++/classes.exp (test_nonexistant_members): Fix name
gdb_test "print g_D.p" "There is no member( or method|) named p." "print g_D.p should be error"
}
+#
+# Call a method that expects a base class parameter with base, inherited,
+# and unrelated class arguments.
+#
+
+proc test_method_param_class {} {
+ gdb_test "call class_param.Aptr_a (&g_A)" ".* = 1" "base class param->a"
+ gdb_test "call class_param.Aptr_x (&g_A)" ".* = 2" "base class param->x"
+ gdb_test "call class_param.Aptr_a (&g_B)" ".* = 3" "inherited class param->a"
+ gdb_test "call class_param.Aptr_x (&g_B)" ".* = 4" "inherited class param->x"
+ gdb_test "call class_param.Aref_a (g_A)" ".* = 1" "base class (¶m)->a"
+ gdb_test "call class_param.Aref_x (g_A)" ".* = 2" "base class (¶m)->x"
+ gdb_test "call class_param.Aref_a (g_B)" ".* = 3" "inherited class (¶m)->a"
+ gdb_test "call class_param.Aref_x (g_B)" ".* = 4" "inherited class (¶m)->x"
+ gdb_test "call class_param.Aval_a (g_A)" ".* = 1" "base class param.a"
+ gdb_test "call class_param.Aval_x (g_A)" ".* = 2" "base class param.x"
+ gdb_test "call class_param.Aval_a (g_B)" ".* = 3" "inherited class param.a"
+ gdb_test "call class_param.Aval_x (g_B)" ".* = 4" "inherited class param.x"
+
+ gdb_test "call class_param.Aptr_a (&foo)" "Cannot resolve .*" "unrelated class *param"
+ gdb_test "call class_param.Aref_a (foo)" "Cannot resolve .*" "unrelated class ¶m"
+ gdb_test "call class_param.Aval_a (foo)" "Cannot resolve .*" "unrelated class param"
+}
+
#
# Examine a class with an enum field.
#
test_non_inherited_member_access
test_wrong_class_members
test_nonexistent_members
+ test_method_param_class
}
gdb_breakpoint enums2
obj_with_enum.priv_enum = ClassWithEnum::green;
}
+class ClassParam {
+public:
+ int Aptr_a (A *a) { return a->a; }
+ int Aptr_x (A *a) { return a->x; }
+ int Aref_a (A &a) { return a.a; }
+ int Aref_x (A &a) { return a.x; }
+ int Aval_a (A a) { return a.a; }
+ int Aval_x (A a) { return a.x; }
+};
+
+ClassParam class_param;
+
class Contains_static_instance
{
public:
v_bool_array[1] = v_bool;
}
+void use_methods ()
+{
+ /* Refer to methods so that they don't get optimized away. */
+ int i;
+ i = class_param.Aptr_a (&g_A);
+ i = class_param.Aptr_x (&g_A);
+ i = class_param.Aref_a (g_A);
+ i = class_param.Aref_x (g_A);
+ i = class_param.Aval_a (g_A);
+ i = class_param.Aval_x (g_A);
+}
+
int
main()
/* Make sure the AIX linker doesn't remove the variable. */
v_tagless.one = 5;
+ use_methods ();
+
return foo.*pmi;
}