OSDN Git Service

* gdb.cp/templates.cc (GetMax): New template.
authorguitton <guitton>
Mon, 27 Apr 2009 12:14:08 +0000 (12:14 +0000)
committerguitton <guitton>
Mon, 27 Apr 2009 12:14:08 +0000 (12:14 +0000)
(main): Declare two instances of GetMax.
* gdb.cp/templates.exp: Add new test.

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

index fac1f19..694d4ad 100644 (file)
@@ -1,3 +1,9 @@
+2009-04-27  Jerome Guitton  <guitton@adacore.com>
+
+       * gdb.cp/templates.cc (GetMax): New template.
+       (main): Declare two instances of GetMax.
+       * gdb.cp/templates.exp: Add new test.
+
 2009-04-27  Jan Kratochvil  <jan.kratochvil@redhat.com>
 
        * gdb.cp/abstract-origin.exp, gdb.cp/abstract-origin.cc: New test.
index c13f18b..a04d768 100644 (file)
@@ -492,6 +492,13 @@ int
 T5<T>::value()
 { return val; }
 
+template <class T>
+T GetMax (T a, T b) {
+  T result;
+  result = (a>b)? a : b;
+  // set breakpoint on a line with no real code
+  return (result);
+}
 
 #if ! defined(__GNUC__) || defined(GCC_BUG)
 template<class T>
@@ -706,6 +713,7 @@ template<class T> T Garply<T>::garply (int i, T tt)
 int main()
 {
     int i;
+    long l, m, n;
 #ifdef usestubs
     set_debug_traps();
     breakpoint();
@@ -766,6 +774,8 @@ int main()
 
   y = x + fc.x;
   
+  i=GetMax<int>(x,y);
+  n=GetMax<long>(l,m);
 
   return 0;
     
index f49caff..541bdcb 100644 (file)
@@ -157,6 +157,11 @@ proc test_template_breakpoints {} {
        "Breakpoint.*at.* file .*${testfile}.cc, line.*" \
        "value method breakpoint"
 
+    set bp_location [gdb_get_line_number \
+                         "set breakpoint on a line with no real code"]
+    gdb_test "break ${testfile}.cc:${bp_location}" \
+        "Breakpoint.*at.* file .*${testfile}.cc, line.*(2 locations).*" \
+        "breakpoint on a line with no real code"
     delete_breakpoints
 }