29d49d9
http://sourceware.org/ml/gdb-patches/2010-12/msg00264.html
29d49d9
29d49d9
Index: gdb-7.2/gdb/testsuite/gdb.cp/pr12273.cc
29d49d9
===================================================================
29d49d9
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
29d49d9
+++ gdb-7.2/gdb/testsuite/gdb.cp/pr12273.cc	2011-02-03 22:31:01.000000000 +0100
29d49d9
@@ -0,0 +1,37 @@
29d49d9
+/* This test case is part of GDB, the GNU debugger.
29d49d9
+
29d49d9
+   Copyright 2010 Free Software Foundation, Inc.
29d49d9
+
29d49d9
+   This program is free software; you can redistribute it and/or modify
29d49d9
+   it under the terms of the GNU General Public License as published by
29d49d9
+   the Free Software Foundation; either version 3 of the License, or
29d49d9
+   (at your option) any later version.
29d49d9
+
29d49d9
+   This program is distributed in the hope that it will be useful,
29d49d9
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
29d49d9
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
29d49d9
+   GNU General Public License for more details.
29d49d9
+
29d49d9
+   You should have received a copy of the GNU General Public License
29d49d9
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
29d49d9
+
29d49d9
+template <typename T>
29d49d9
+class GDB
29d49d9
+{
29d49d9
+ public:
29d49d9
+   static int simple (void) { return 0; }
29d49d9
+   static int harder (T a) { return 1; }
29d49d9
+   template <typename X>
29d49d9
+   static X even_harder (T a) { return static_cast<X> (a); }
29d49d9
+   int operator == (GDB const& other)
29d49d9
+   { return 1; }
29d49d9
+};
29d49d9
+
29d49d9
+int main(int argc, char **argv)
29d49d9
+{
29d49d9
+   GDB<int> a, b;
29d49d9
+   if (a == b)
29d49d9
+     return GDB<char>::harder('a') + GDB<int>::harder(3)
29d49d9
+	+ GDB<char>::even_harder<int> ('a');
29d49d9
+   return GDB<int>::simple ();
29d49d9
+}
29d49d9
Index: gdb-7.2/gdb/testsuite/gdb.cp/pr12273.exp
29d49d9
===================================================================
29d49d9
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
29d49d9
+++ gdb-7.2/gdb/testsuite/gdb.cp/pr12273.exp	2011-02-03 22:31:01.000000000 +0100
29d49d9
@@ -0,0 +1,46 @@
29d49d9
+# Copyright 2010 Free Software Foundation, Inc.
29d49d9
+#
29d49d9
+# Contributed by Red Hat, originally written by Keith Seitz.
29d49d9
+#
29d49d9
+# This program is free software; you can redistribute it and/or modify
29d49d9
+# it under the terms of the GNU General Public License as published by
29d49d9
+# the Free Software Foundation; either version 3 of the License, or
29d49d9
+# (at your option) any later version.
29d49d9
+#
29d49d9
+# This program is distributed in the hope that it will be useful,
29d49d9
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
29d49d9
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
29d49d9
+# GNU General Public License for more details.
29d49d9
+#
29d49d9
+# You should have received a copy of the GNU General Public License
29d49d9
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
29d49d9
+
29d49d9
+# This file is part of the gdb testsuite.
29d49d9
+
29d49d9
+if {[skip_cplus_tests]} { continue }
29d49d9
+
29d49d9
+set testfile "pr12273"
29d49d9
+# Do NOT compile with debug flag.
29d49d9
+prepare_for_testing pr12273 $testfile $testfile.cc {c++}
29d49d9
+
29d49d9
+gdb_test_no_output "set language c++"
29d49d9
+
29d49d9
+# A list of minimal symbol names to check.
29d49d9
+# Note that GDB<char>::even_harder<int>(char) is quoted and includes
29d49d9
+# the return type.  This is necessary because this is the demangled name
29d49d9
+# of the minimal symbol.
29d49d9
+set min_syms [list \
29d49d9
+		  "GDB<int>::operator ==" \
29d49d9
+		  "GDB<int>::operator==(GDB<int> const&)" \
29d49d9
+		  "GDB<char>::harder(char)" \
29d49d9
+		  "GDB<int>::harder(int)" \
29d49d9
+		  {"int GDB<char>::even_harder<int>(char)"} \
29d49d9
+		  "GDB<int>::simple()"]
29d49d9
+
29d49d9
+foreach sym $min_syms {
29d49d9
+    if {[gdb_breakpoint $sym]} {
29d49d9
+	pass "setting breakpoint at $sym"
29d49d9
+    }
29d49d9
+}
29d49d9
+
29d49d9
+gdb_exit