diff options
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/testsuite/gdb.c++/ambiguous.cc | 110 | ||||
-rw-r--r-- | gdb/testsuite/gdb.c++/ambiguous.exp | 235 | ||||
-rw-r--r-- | gdb/testsuite/gdb.c++/ctti.exp | 268 | ||||
-rw-r--r-- | gdb/testsuite/gdb.c++/cttiadd.cc | 29 | ||||
-rw-r--r-- | gdb/testsuite/gdb.c++/cttiadd1.cc | 16 | ||||
-rw-r--r-- | gdb/testsuite/gdb.c++/cttiadd2.cc | 22 | ||||
-rw-r--r-- | gdb/testsuite/gdb.c++/cttiadd3.cc | 33 |
7 files changed, 713 insertions, 0 deletions
diff --git a/gdb/testsuite/gdb.c++/ambiguous.cc b/gdb/testsuite/gdb.c++/ambiguous.cc new file mode 100644 index 00000000000..6ee7bc18ea9 --- /dev/null +++ b/gdb/testsuite/gdb.c++/ambiguous.cc @@ -0,0 +1,110 @@ + +void marker1() +{ + return; +} + +class A1 { +public: + int x; + int y; +}; + +class A2 { +public: + int x; + int y; +}; + +class A3 { +public: + int x; + int y; +}; + +class X : public A1, public A2 { +public: + int z; +}; + +class L : public A1 { +public: + int z; +}; + +class LV : public virtual A1 { +public: + int z; +}; + +class M : public A2 { +public: + int w; +}; + +class N : public L, public M { +public: + int r; +}; + +class K : public A1 { +public: + int i; +}; + +class KV : public virtual A1 { +public: + int i; +}; + +class J : public K, public L { +public: + int j; +}; + +class JV : public KV, public LV { +public: + int jv; +}; + +class JVA1 : public KV, public LV, public A1 { +public: + int jva1; +}; + +class JVA2 : public KV, public LV, public A2 { +public: + int jva2; +}; + +class JVA1V : public KV, public LV, public virtual A1 { +public: + int jva1v; +}; + +int main() +{ + A1 a1; + A2 a2; + A3 a3; + X x; + L l; + M m; + N n; + K k; + J j; + JV jv; + JVA1 jva1; + JVA2 jva2; + JVA1V jva1v; + + int i; + + i += k.i + m.w + a1.x + a2.x + a3.x + x.z + l.z + n.r + j.j; + + marker1(); + +} + + + diff --git a/gdb/testsuite/gdb.c++/ambiguous.exp b/gdb/testsuite/gdb.c++/ambiguous.exp new file mode 100644 index 00000000000..998b47894c5 --- /dev/null +++ b/gdb/testsuite/gdb.c++/ambiguous.exp @@ -0,0 +1,235 @@ +# Copyright (C) 1998 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +# Please email any bugs, comments, and/or additions to this file to: +# bug-gdb@prep.ai.mit.edu + +# This file is part of the gdb testsuite + +# tests relating to ambiguous class members +# Written by Satish Pai <pai@apollo.hp.com> 1997-07-28 + +# This file is part of the gdb testsuite + +if $tracelevel then { + strace $tracelevel + } + +# +# test running programs +# + +set prms_id 0 +set bug_id 0 + +set testfile "ambiguous" +set srcfile ${testfile}.cc +set binfile ${objdir}/${subdir}/${testfile} + +if [get_compiler_info ${binfile} "c++"] { + return -1; +} + +if { $gcc_compiled } then { continue } + +if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug c++}] != "" } { + gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." +} + + +gdb_exit +gdb_start +gdb_reinitialize_dir $srcdir/$subdir +gdb_load ${binfile} + + +# +# set it up at a breakpoint so we can play with the variable values +# +if ![runto_main] then { + perror "couldn't run to breakpoint" + continue +} + +send_gdb "break marker1\n" ; gdb_expect -re ".*$gdb_prompt $" + send_gdb "cont\n" + gdb_expect { + -re "Break.* marker1 \\(\\) at .*:$decimal.*$gdb_prompt $" { + send_gdb "up\n" + gdb_expect { + -re ".*$gdb_prompt $" { pass "up from marker1" } + timeout { fail "up from marker1" } + } + } + -re "$gdb_prompt $" { fail "continue to marker1" } + timeout { fail "(timeout) continue to marker1" } + } + +# print out various class objects' members. The values aren't +# important, just check that the warning is emitted at the +# right times. + +# X is derived from A1 and A2; both A1 and A2 have a member 'x' +send_gdb "print x.x\n" +gdb_expect { + -re "warning: x ambiguous; using X::A2::x. Use a cast to disambiguate.\r\n\\$\[0-9\]* = \[-\]*\[0-9\]*\r\n$gdb_prompt $" { + pass "print x.x" + } + -re "warning: x ambiguous; using X::A1::x. Use a cast to disambiguate.\r\n\\$\[0-9\]* = \[-\]*\[0-9\]*\r\n$gdb_prompt $" { + pass "print x.x" + } + -re ".*$gdb_prompt $" { fail "print x.x" } + timeout { fail "(timeout) print x.x" } +} + + +# N is derived from A1 and A2, but not immediately -- two steps +# up in the hierarchy. Both A1 and A2 have a member 'x'. +send_gdb "print n.x\n" +gdb_expect { + -re "warning: x ambiguous; using N::M::A2::x. Use a cast to disambiguate.\r\n\\$\[0-9\]* = \[-\]*\[0-9\]*\r\n$gdb_prompt $" { + pass "print n.x" + } + -re "warning: x ambiguous; using N::L::A1::x. Use a cast to disambiguate.\r\n\\$\[0-9\]* = \[-\]*\[0-9\]*\r\n$gdb_prompt $" { + pass "print n.x" + } + -re ".*$gdb_prompt $" { fail "print n.x" } + timeout { fail "(timeout) print n.x" } +} + +# J is derived from A1 twice. A1 has a member x. +send_gdb "print j.x\n" +gdb_expect { + -re "warning: x ambiguous; using J::L::A1::x. Use a cast to disambiguate.\r\n\\$\[0-9\]* = \[-\]*\[0-9\]*\r\n$gdb_prompt $" { + pass "print j.x" + } + -re "warning: x ambiguous; using J::K::A1::x. Use a cast to disambiguate.\r\n\\$\[0-9\]* = \[-\]*\[0-9\]*\r\n$gdb_prompt $" { + pass "print j.x" + } + -re ".*$gdb_prompt $" { fail "print j.x" } + timeout { fail "(timeout) print j.x" } +} + +# JV is derived from A1 but A1 is a virtual base. Should not +# report an ambiguity in this case. +send_gdb "print jv.x\n" +gdb_expect { + -re "warning: x ambiguous.*Use a cast to disambiguate.\r\n\\$\[0-9\]* = \[-\]*\[0-9\]*\r\n$gdb_prompt $" { + fail "print jv.x (ambiguity reported)" + } + -re "\\$\[0-9\]* = \[-\]*\[0-9\]*\r\n$gdb_prompt $" { pass "print jv.x" } + -re ".*$gdb_prompt $" { fail "print jv.x (??)" } + timeout { fail "(timeout) print jv.x" } +} + +# JVA1 is derived from A1; A1 occurs as a virtual base in two +# ancestors, and as a non-virtual immediate base. Ambiguity must +# be reported. +send_gdb "print jva1.x\n" +gdb_expect { + -re "warning: x ambiguous; using JVA1::A1::x. Use a cast to disambiguate.\r\n\\$\[0-9\]* = \[-\]*\[0-9\]*\r\n$gdb_prompt $" { + pass "print jva1.x" + } + -re "warning: x ambiguous; using JVA1::KV::A1::x. Use a cast to disambiguate.\r\n\\$\[0-9\]* = \[-\]*\[0-9\]*\r\n$gdb_prompt $" { + pass "print jva1.x" + } + -re ".*$gdb_prompt $" { fail "print jva1.x" } + timeout { fail "(timeout) print jva1.x" } +} + +# JVA2 is derived from A1 & A2; A1 occurs as a virtual base in two +# ancestors, and A2 is a non-virtual immediate base. Ambiguity must +# be reported as A1 and A2 both have a member 'x'. +send_gdb "print jva2.x\n" +gdb_expect { + -re "warning: x ambiguous; using JVA2::A2::x. Use a cast to disambiguate.\r\n\\$\[0-9\]* = \[-\]*\[0-9\]*\r\n$gdb_prompt $" { + pass "print jva2.x" + } + -re "warning: x ambiguous; using JVA2::KV::A1::x. Use a cast to disambiguate.\r\n\\$\[0-9\]* = \[-\]*\[0-9\]*\r\n$gdb_prompt $" { + pass "print jva2.x" + } + -re ".*$gdb_prompt $" { fail "print jva2.x" } + timeout { fail "(timeout) print jva2.x" } +} + +# JVA1V is derived from A1; A1 occurs as a virtual base in two +# ancestors, and also as a virtual immediate base. Ambiguity must +# not be reported. +send_gdb "print jva1v.x\n" +gdb_expect { + -re "warning: x ambiguous.*Use a cast to disambiguate.\r\n\\$\[0-9\]* = \[-\]*\[0-9\]*\r\n$gdb_prompt $" { + fail "print jva1v.x (ambiguity reported)" + } + -re "\\$\[0-9\]* = \[-\]*\[0-9\]*\r\n$gdb_prompt $" { pass "print jva1v.x" } + -re ".*$gdb_prompt $" { fail "print jva1v.x (??)" } + timeout { fail "(timeout) print jva1v.x" } +} + +# Now check for ambiguous bases. + +# J is derived from A1 twice; report ambiguity if a J is +# cast to an A1. +send_gdb "print (A1)j\n" +gdb_expect { + -re "warning: A1 ambiguous; using J::L::A1. Use a cast to disambiguate.\r\n\\$\[0-9\]* = \{x = \[-\]*\[0-9\]*, y = \[-\]*\[0-9\]*\}\r\n$gdb_prompt $" { + pass "print (A1)j" + } + -re "warning: A1 ambiguous; using J::K::A1. Use a cast to disambiguate.\r\n\\$\[0-9\]* = \{x = \[-\]*\[0-9\]*, y = \[-\]*\[0-9\]*\}\r\n$gdb_prompt $" { + pass "print (A1)j" + } + -re ".*$gdb_prompt $" { fail "print (A1)j" } + timeout { fail "(timeout) print (A1)j" } +} + +# JV is derived from A1 twice, but A1 is a virtual base; should +# not report ambiguity when a JV is cast to an A1. +send_gdb "print (A1)jv\n" +gdb_expect { + -re "warning: A1 ambiguous.*Use a cast to disambiguate.\r\n\\$\[0-9\]* = \{x = \[-\]*\[0-9\]*, y = \[-\]*\[0-9\]*\}\r\n$gdb_prompt $" { + fail "print (A1)jv (ambiguity reported)" + } + -re "\\$\[0-9\]* = \{x = \[-\]*\[0-9\]*, y = \[-\]*\[0-9\]*\}\r\n$gdb_prompt $" { pass "print (A1)jv" } + -re ".*$gdb_prompt $" { fail "print (A1)jv (??)" } + timeout { fail "(timeout) print (A1)jv" } +} + +# JVA1 is derived from A1; A1 is a virtual base and also a +# non-virtual base. Must report ambiguity if a JVA1 is cast to an A1. +send_gdb "print (A1)jva1\n" +gdb_expect { + -re "warning: A1 ambiguous; using JVA1::A1. Use a cast to disambiguate.\r\n\\$\[0-9\]* = \{x = \[-\]*\[0-9\]*, y = \[-\]*\[0-9\]*\}\r\n$gdb_prompt $" { + pass "print (A1)jva1" + } + -re "warning: A1 ambiguous; using JVA1::KV::A1. Use a cast to disambiguate.\r\n\\$\[0-9\]* = \{x = \[-\]*\[0-9\]*, y = \[-\]*\[0-9\]*\}\r\n$gdb_prompt $" { + pass "print (A1)jva1" + } + -re ".*$gdb_prompt $" { fail "print (A1)jva1" } + timeout { fail "(timeout) print (A1)jva1" } +} + +# JVA1V is derived from A1; A1 is a virtual base indirectly +# and also directly; must not report ambiguity when a JVA1V is cast to an A1. +send_gdb "print (A1)jva1v\n" +gdb_expect { + -re "warning: A1 ambiguous.*Use a cast to disambiguate.\r\n\\$\[0-9\]* = \{x = \[-\]*\[0-9\]*, y = \[-\]*\[0-9\]*\}\r\n$gdb_prompt $" { + fail "print (A1)jva1v (ambiguity reported)" + } + -re "\\$\[0-9\]* = \{x = \[-\]*\[0-9\]*, y = \[-\]*\[0-9\]*\}\r\n$gdb_prompt $" { pass "print (A1)jva1v" + } + -re ".*$gdb_prompt $" { fail "print (A1)jva1v (??)" } + timeout { fail "(timeout) print (A1)jva1v" } +} + diff --git a/gdb/testsuite/gdb.c++/ctti.exp b/gdb/testsuite/gdb.c++/ctti.exp new file mode 100644 index 00000000000..b8c7cc91e5e --- /dev/null +++ b/gdb/testsuite/gdb.c++/ctti.exp @@ -0,0 +1,268 @@ +# Copyright (C) 1998 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +# Please email any bugs, comments, and/or additions to this file to: +# bug-gdb@prep.ai.mit.edu + + +# This file is part of the gdb testsuite +# file written by Elena Zannoni (ezannoni@cygnus.com) +# +# source files cttiadd.cc, cttiadd1.cc, cttiadd2.cc, cttiadd3.cc +# + + +if $tracelevel then { + strace $tracelevel +} + + +# Check to see if we have an executable to test. If not, then either we +# haven't tried to compile one, or the compilation failed for some reason. +# In either case, just notify the user and skip the tests in this file. + +set testfile "cttiadd" +set srcfile ${testfile}.cc +set srcfile1 ${testfile}1.cc +set srcfile2 ${testfile}2.cc +set srcfile3 ${testfile}3.cc +set binfile ${objdir}/${subdir}/${testfile} + +if [get_compiler_info ${binfile} "c++"] { + return -1; +} + +if { $gcc_compiled } then { continue } + +#if { [gdb_compile "${srcdir}/${subdir}/${srcfile} ${srcdir}/${subdir}/${srcfile1} ${srcdir}/${subdir}/${srcfile2} ${srcdir}/${subdir}/${srcfile3}" "${binfile}" executable {debug c++}] != "" } { +# gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." +#} + +set cmdline "$CXX_FOR_TARGET ${srcdir}/${subdir}/${srcfile} ${srcdir}/${subdir}/${srcfile1} ${srcdir}/${subdir}/${srcfile2} ${srcdir}/${subdir}/${srcfile3} -g -o ${binfile}" + +remote_exec build $cmdline + +gdb_exit +gdb_start +gdb_reinitialize_dir $srcdir/$subdir +gdb_load ${binfile} + + + +if ![runto_main] then { + perror "couldn't run to breakpoint" + continue +} + + +send_gdb "n\n" +gdb_expect { + -re "$decimal.*i = 2;.*$gdb_prompt $" { + pass "next " + } + -re ".*$gdb_prompt $" { fail "next " } + timeout { fail "next " } + } + + +send_gdb "n\n" +gdb_expect { + -re "$decimal.*f = 4.5;.*$gdb_prompt $" { + pass "next " + } + -re ".*$gdb_prompt $" { fail "next " } + timeout { fail "next " } + } + +send_gdb "n\n" +gdb_expect { + -re "$decimal.*c = add\\(c, c\\);.*$gdb_prompt $" { + pass "next " + } + -re ".*$gdb_prompt $" { fail "next " } + timeout { fail "next " } + } + +send_gdb "n\n" +gdb_expect { + -re "$decimal.*i = add\\(i, i\\);.*$gdb_prompt $" { + pass "next " + } + -re ".*$gdb_prompt $" { fail "next " } + timeout { fail "next " } + } + +send_gdb "n\n" +gdb_expect { + -re "$decimal.*f = add\\(f, f\\);.*$gdb_prompt $" { + pass "next " + } + -re ".*$gdb_prompt $" { fail "next " } + timeout { fail "next " } + } + +send_gdb "n\n" +gdb_expect { + -re "$decimal.*add1\\(\\);.*$gdb_prompt $" { + pass "next " + } + -re ".*$gdb_prompt $" { fail "next " } + timeout { fail "next " } + } + +send_gdb "print c\n" +gdb_expect { + -re ".$decimal = -62.*\r\n$gdb_prompt $" { + pass "print value of c" + } + -re ".*$gdb_prompt $" { fail "print value of c" } + timeout { fail "(timeout) print value of c" } + } + + +send_gdb "print f\n" +gdb_expect { + -re ".$decimal = 9\r\n$gdb_prompt $" { + pass "print value of f" + } + -re ".*$gdb_prompt $" { fail "print value of f" } + timeout { fail "(timeout) print value of f" } + } + + +send_gdb "print i\n" +gdb_expect { + -re ".$decimal = 4\r\n$gdb_prompt $" { + pass "print value of i" + } + -re ".*$gdb_prompt $" { fail "print value of i" } + timeout { fail "(timeout) print value of i" } + } + + + +send_gdb "print add<int>(2,2)\n" +gdb_expect { + -re ".$decimal = 4\r\n$gdb_prompt $" { + pass "print value of add<int>(2,2)" + } + -re ".*$gdb_prompt $" { fail "print value of add<int>(2,2)" } + timeout { fail "(timeout) print value of add<int>(2,2)" } + } + +send_gdb "print add<float>(2.3,2.3)\n" +gdb_expect { + -re ".$decimal = 4\\.5\[0-9\]+\r\n$gdb_prompt $" { + pass "print value of add<float>(2.3,2.3)" + } + -re ".*$gdb_prompt $" { fail "print value of add<float>(2.3,2.3)" } + timeout { fail "(timeout) print value of add<float>(2.3,2.3)" } + } + +send_gdb "print add<char>('A','A')\n" +gdb_expect { + -re ".$decimal = -126.*202.\r\n$gdb_prompt $" { + pass "print value of add<char>('A','A')" + } + -re ".*$gdb_prompt $" { fail "print value of add<char>('A','A')" } + timeout { fail "(timeout) print value of add<char>('A','A')" } + } + + +send_gdb "print add2<int>(2,2)\n" +gdb_expect { + -re ".$decimal = 4\r\n$gdb_prompt $" { + pass "print value of add2<int>(2,2)" + } + -re ".*$gdb_prompt $" { fail "print value of add2<int>(2,2)" } + timeout { fail "(timeout) print value of add2<int>(2,2)" } + } + +send_gdb "print add2<float>(2.3,2.3)\n" +gdb_expect { + -re ".$decimal = 4\\.5\[0-9\]+\r\n$gdb_prompt $" { + pass "print value of add2<float>(2.3,2.3)" + } + -re ".*$gdb_prompt $" { fail "print value of add2<float>(2.3,2.3)" } + timeout { fail "(timeout) print value of add2<float>(2.3,2.3)" } + } + +send_gdb "print add2<char>('A','A')\n" +gdb_expect { + -re ".$decimal = -126.*202.\r\n$gdb_prompt $" { + pass "print value of add2<char>('A','A')" + } + -re ".*$gdb_prompt $" { fail "print value of add2<char>('A','A')" } + timeout { fail "(timeout) print value of add2<char>('A','A')" } + } + +send_gdb "print add3<int>(2,2)\n" +gdb_expect { + -re ".$decimal = 4\r\n$gdb_prompt $" { + pass "print value of add3<int>(2,2)" + } + -re ".*$gdb_prompt $" { fail "print value of add3<int>(2,2)" } + timeout { fail "(timeout) print value of add3<int>(2,2)" } + } + +send_gdb "print add3<float>(2.3,2.3)\n" +gdb_expect { + -re ".$decimal = 4\\.5\[0-9\]+\r\n$gdb_prompt $" { + pass "print value of add3<float>(2.3,2.3)" + } + -re ".*$gdb_prompt $" { fail "print value of add3<float>(2.3,2.3)" } + timeout { fail "(timeout) print value of add3<float>(2.3,2.3)" } + } + +send_gdb "print add3<char>('A','A')\n" +gdb_expect { + -re ".$decimal = -126.*202.\r\n$gdb_prompt $" { + pass "print value of add3<char>('A','A')" + } + -re ".*$gdb_prompt $" { fail "print value of add3<char>('A','A')" } + timeout { fail "(timeout) print value of add3<char>('A','A')" } + } + +send_gdb "print add4<int>(2,2)\n" +gdb_expect { + -re ".$decimal = 4\r\n$gdb_prompt $" { + pass "print value of add4<int>(2,2)" + } + -re ".*$gdb_prompt $" { fail "print value of add4<int>(2,2)" } + timeout { fail "(timeout) print value of add4<int>(2,2)" } + } + +send_gdb "print add4<float>(2.3,2.3)\n" +gdb_expect { + -re ".$decimal = 4\\.5\[0-9\]+\r\n$gdb_prompt $" { + pass "print value of add4<float>(2.3,2.3)" + } + -re ".*$gdb_prompt $" { fail "print value of add4<float>(2.3,2.3)" } + timeout { fail "(timeout) print value of add4<float>(2.3,2.3)" } + } + +send_gdb "print add4<char>('A','A')\n" +gdb_expect { + -re ".$decimal = -126.*202.\r\n$gdb_prompt $" { + pass "print value of add4<char>('A','A')" + } + -re ".*$gdb_prompt $" { fail "print value of add4<char>('A','A')" } + timeout { fail "(timeout) print value of add4<char>('A','A')" } + } + + +gdb_exit +return 0 diff --git a/gdb/testsuite/gdb.c++/cttiadd.cc b/gdb/testsuite/gdb.c++/cttiadd.cc new file mode 100644 index 00000000000..1f50fae24c1 --- /dev/null +++ b/gdb/testsuite/gdb.c++/cttiadd.cc @@ -0,0 +1,29 @@ +template<class T> T add(T v1, T v2) +{ + T v3; + v3 = v1; + v3 += v2; + return v3; + } + +int main() +{ + char c; + int i; + float f; + extern void add1(); + extern void subr2(); + extern void subr3(); + + c = 'a'; + i = 2; + f = 4.5; + + c = add(c, c); + i = add(i, i); + f = add(f, f); + + add1(); + subr2(); + subr3(); +} diff --git a/gdb/testsuite/gdb.c++/cttiadd1.cc b/gdb/testsuite/gdb.c++/cttiadd1.cc new file mode 100644 index 00000000000..7113ecea421 --- /dev/null +++ b/gdb/testsuite/gdb.c++/cttiadd1.cc @@ -0,0 +1,16 @@ +template<class T> T add(T v1, T v2); + +void add1() +{ + char c; + int i; + float f; + + c = 'b'; + i = 3; + f = 6.5; + + c = add(c, c); + i = add(i, i); + f = add(f, f); +} diff --git a/gdb/testsuite/gdb.c++/cttiadd2.cc b/gdb/testsuite/gdb.c++/cttiadd2.cc new file mode 100644 index 00000000000..d0d9891fb2f --- /dev/null +++ b/gdb/testsuite/gdb.c++/cttiadd2.cc @@ -0,0 +1,22 @@ +template<class T> T add2(T v1, T v2) +{ + T v3; + v3 = v1; + v3 += v2; + return v3; +} + +void subr2() +{ + char c; + int i; + float f; + + c = 'b'; + i = 3; + f = 6.5; + + c = add2(c, c); + i = add2(i, i); + f = add2(f, f); +} diff --git a/gdb/testsuite/gdb.c++/cttiadd3.cc b/gdb/testsuite/gdb.c++/cttiadd3.cc new file mode 100644 index 00000000000..7ba1b019f16 --- /dev/null +++ b/gdb/testsuite/gdb.c++/cttiadd3.cc @@ -0,0 +1,33 @@ +template<class T> T add3(T v1, T v2) +{ + T v3; + v3 = v1; + v3 += v2; + return v3; +} + +template<class T> T add4(T v1, T v2) +{ + T v3; + v3 = v1; + v3 += v2; + return v3; +} + +void subr3() +{ + char c; + int i; + float f; + + c = 'b'; + i = 3; + f = 6.5; + + c = add3(c, c); + i = add3(i, i); + f = add3(f, f); + c = add4(c, c); + i = add4(i, i); + f = add4(f, f); +} |