]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
* gdb.cp/classes.exp (do_tests): Add tests to print a constructor
authorKeith Seitz <keiths@redhat.com>
Mon, 21 Sep 2009 19:23:22 +0000 (19:23 +0000)
committerKeith Seitz <keiths@redhat.com>
Mon, 21 Sep 2009 19:23:22 +0000 (19:23 +0000)
and destructor using typedef name of class.
* gdb.cp/classes.cc (class Base1): Add a destructor.
(base1): New typedef.
(use_methods): Instanitate an object of type base1.
* gdb.cp/templates.exp (test_template_typedef): New procedure.
(do_tests): Call test_template_typedef.
* gdb.cp/templates.cc (Baz::~Baz): New method.
(intBazOne): New typedef.
(main): Instantiate intBazOne.

gdb/testsuite/ChangeLog
gdb/testsuite/gdb.cp/classes.cc
gdb/testsuite/gdb.cp/classes.exp
gdb/testsuite/gdb.cp/templates.cc
gdb/testsuite/gdb.cp/templates.exp

index 833fdcd486e2ea297656d8eb787699cc1085430c..72b1e1ca1783972c95123901cf896deed199847a 100644 (file)
@@ -1,3 +1,16 @@
+2009-09-21  Keith Seitz  <keiths@redhat.com>
+
+       * gdb.cp/classes.exp (do_tests): Add tests to print a constructor
+       and destructor using typedef name of class.
+       * gdb.cp/classes.cc (class Base1): Add a destructor.
+       (base1): New typedef.
+       (use_methods): Instanitate an object of type base1.
+       * gdb.cp/templates.exp (test_template_typedef): New procedure.
+       (do_tests): Call test_template_typedef.
+       * gdb.cp/templates.cc (Baz::~Baz): New method.
+       (intBazOne): New typedef.
+       (main): Instantiate intBazOne.
+
 2009-09-21  Phil Muldoon <pmuldoon@redhat.com>
 
        PR python/10633
index 927aad3682b151e1b2ee4fa5aab7c0680f49c6d1..913627fe1b3705405edd19636212d5d208c94710 100644 (file)
@@ -400,8 +400,11 @@ class Base1 {
  public:
   int x;
   Base1(int i) { x = i; }
+  ~Base1 () { }
 };
 
+typedef Base1 base1;
+
 class Foo
 {
  public:
@@ -564,6 +567,8 @@ void use_methods ()
   i = class_param.Aref_x (g_A);
   i = class_param.Aval_a (g_A);
   i = class_param.Aval_x (g_A);
+
+  base1 b (3);
 }
 
 
index bd980b25fb96f3dca9238308246ed08e9381fbcc..87e993c7fdd4065e2042949a306d05ef9ebb5796 100644 (file)
@@ -632,6 +632,10 @@ proc do_tests {} {
            fail "calling method for small class"
        }
     }
+
+    gdb_test "print base1::Base1" "<.*Base1.*>" "print ctor of typedef class"
+    gdb_test "print base1::~Base1" "<.*~Base1(\\(\\))?>" \
+       "print dtor of typedef class"
 }
 
 do_tests
index a04d76866fa68b174787f19937d41ccdcc60cf27..dfb6f8ea79059e9f3e6bcbe9d3c9f13eed0e79b9 100644 (file)
@@ -630,6 +630,7 @@ T Spec<T, T*>::spec (T * tp)
 template<class T, char sz>
 class Baz {
 public:
+  ~Baz () { };
   int x;
   T t;
   T baz (int, T);
@@ -643,6 +644,8 @@ template<class T, char sz> T Baz<T, sz>::baz (int i, T tt)
     return 0;
 }
 
+typedef Baz<int, 1> intBazOne;
+
 // Template with char * parameter
 template<class T, char * sz>
 class Qux {
@@ -777,6 +780,8 @@ int main()
   i=GetMax<int>(x,y);
   n=GetMax<long>(l,m);
 
+  intBazOne ibo;
+  z = ibo.baz (2, 21);
   return 0;
     
 }
index 541bdcb7bf14273e542b01a2c71e904cf7ec5cef..487186a8ae0e3d5cae0e2537e6586ef9a8343553 100644 (file)
@@ -195,6 +195,14 @@ proc test_template_calls {} {
     }
 }
 
+proc test_template_typedef {} {
+
+    gdb_test "print intBazOne::baz" ".*baz\\(int, int\\)>" \
+       "print method of template typedef"
+
+    gdb_test "print intBazOne::~Baz" ".*~Baz(\\(\\))?>" \
+       "print destructor of template typedef"
+}
 
 proc do_tests {} {
     global prms_id
@@ -223,6 +231,7 @@ proc do_tests {} {
 
     test_ptype_of_templates
     test_template_breakpoints
+    test_template_typedef
 
     if [ runto_main] {
        test_template_calls