From 945a118de0fdc7934635cfe263d14444ebbdd403 Mon Sep 17 00:00:00 2001 From: Jerome Guitton Date: Mon, 27 Apr 2009 12:14:09 +0000 Subject: [PATCH] * gdb.cp/templates.cc (GetMax): New template. (main): Declare two instances of GetMax. * gdb.cp/templates.exp: Add new test. --- gdb/testsuite/ChangeLog | 6 ++++++ gdb/testsuite/gdb.cp/templates.cc | 10 ++++++++++ gdb/testsuite/gdb.cp/templates.exp | 5 +++++ 3 files changed, 21 insertions(+) diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index fac1f1970c3..694d4adc1df 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2009-04-27 Jerome Guitton + + * 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 * gdb.cp/abstract-origin.exp, gdb.cp/abstract-origin.cc: New test. diff --git a/gdb/testsuite/gdb.cp/templates.cc b/gdb/testsuite/gdb.cp/templates.cc index c13f18b643f..a04d76866fa 100644 --- a/gdb/testsuite/gdb.cp/templates.cc +++ b/gdb/testsuite/gdb.cp/templates.cc @@ -492,6 +492,13 @@ int T5::value() { return val; } +template +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 @@ -706,6 +713,7 @@ template T Garply::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(x,y); + n=GetMax(l,m); return 0; diff --git a/gdb/testsuite/gdb.cp/templates.exp b/gdb/testsuite/gdb.cp/templates.exp index f49caffc6fe..541bdcb7bf1 100644 --- a/gdb/testsuite/gdb.cp/templates.exp +++ b/gdb/testsuite/gdb.cp/templates.exp @@ -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 } -- 2.30.2