a8767b3
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
f524ac5
From: Fedora GDB patches <invalid@email.com>
f524ac5
Date: Fri, 27 Oct 2017 21:07:50 +0200
f524ac5
Subject: gdb-physname-pr12273-test.patch
f524ac5
f637971
;; Fix regressions on C++ names resolving (PR 11734, PR 12273, Keith Seitz).
f637971
;;=fedoratest
f524ac5
Jan Kratochvil 29d49d9
http://sourceware.org/ml/gdb-patches/2010-12/msg00264.html
Jan Kratochvil 29d49d9
f637971
diff --git a/gdb/testsuite/gdb.cp/pr12273.cc b/gdb/testsuite/gdb.cp/pr12273.cc
f637971
new file mode 100644
f637971
--- /dev/null
f637971
+++ b/gdb/testsuite/gdb.cp/pr12273.cc
Jan Kratochvil 29d49d9
@@ -0,0 +1,37 @@
Jan Kratochvil 29d49d9
+/* This test case is part of GDB, the GNU debugger.
Jan Kratochvil 29d49d9
+
Jan Kratochvil 29d49d9
+   Copyright 2010 Free Software Foundation, Inc.
Jan Kratochvil 29d49d9
+
Jan Kratochvil 29d49d9
+   This program is free software; you can redistribute it and/or modify
Jan Kratochvil 29d49d9
+   it under the terms of the GNU General Public License as published by
Jan Kratochvil 29d49d9
+   the Free Software Foundation; either version 3 of the License, or
Jan Kratochvil 29d49d9
+   (at your option) any later version.
Jan Kratochvil 29d49d9
+
Jan Kratochvil 29d49d9
+   This program is distributed in the hope that it will be useful,
Jan Kratochvil 29d49d9
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
Jan Kratochvil 29d49d9
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
Jan Kratochvil 29d49d9
+   GNU General Public License for more details.
Jan Kratochvil 29d49d9
+
Jan Kratochvil 29d49d9
+   You should have received a copy of the GNU General Public License
Jan Kratochvil 29d49d9
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
Jan Kratochvil 29d49d9
+
Jan Kratochvil 29d49d9
+template <typename T>
Jan Kratochvil 29d49d9
+class GDB
Jan Kratochvil 29d49d9
+{
Jan Kratochvil 29d49d9
+ public:
Jan Kratochvil 29d49d9
+   static int simple (void) { return 0; }
Jan Kratochvil 29d49d9
+   static int harder (T a) { return 1; }
Jan Kratochvil 29d49d9
+   template <typename X>
Jan Kratochvil 29d49d9
+   static X even_harder (T a) { return static_cast<X> (a); }
Jan Kratochvil 29d49d9
+   int operator == (GDB const& other)
Jan Kratochvil 29d49d9
+   { return 1; }
Jan Kratochvil 29d49d9
+};
Jan Kratochvil 29d49d9
+
Jan Kratochvil 29d49d9
+int main(int argc, char **argv)
Jan Kratochvil 29d49d9
+{
Jan Kratochvil 29d49d9
+   GDB<int> a, b;
Jan Kratochvil 29d49d9
+   if (a == b)
Jan Kratochvil 29d49d9
+     return GDB<char>::harder('a') + GDB<int>::harder(3)
Jan Kratochvil 29d49d9
+	+ GDB<char>::even_harder<int> ('a');
Jan Kratochvil 29d49d9
+   return GDB<int>::simple ();
Jan Kratochvil 29d49d9
+}
f637971
diff --git a/gdb/testsuite/gdb.cp/pr12273.exp b/gdb/testsuite/gdb.cp/pr12273.exp
f637971
new file mode 100644
f637971
--- /dev/null
f637971
+++ b/gdb/testsuite/gdb.cp/pr12273.exp
Jan Kratochvil 29d49d9
@@ -0,0 +1,46 @@
Jan Kratochvil 29d49d9
+# Copyright 2010 Free Software Foundation, Inc.
Jan Kratochvil 29d49d9
+#
Jan Kratochvil 29d49d9
+# Contributed by Red Hat, originally written by Keith Seitz.
Jan Kratochvil 29d49d9
+#
Jan Kratochvil 29d49d9
+# This program is free software; you can redistribute it and/or modify
Jan Kratochvil 29d49d9
+# it under the terms of the GNU General Public License as published by
Jan Kratochvil 29d49d9
+# the Free Software Foundation; either version 3 of the License, or
Jan Kratochvil 29d49d9
+# (at your option) any later version.
Jan Kratochvil 29d49d9
+#
Jan Kratochvil 29d49d9
+# This program is distributed in the hope that it will be useful,
Jan Kratochvil 29d49d9
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
Jan Kratochvil 29d49d9
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
Jan Kratochvil 29d49d9
+# GNU General Public License for more details.
Jan Kratochvil 29d49d9
+#
Jan Kratochvil 29d49d9
+# You should have received a copy of the GNU General Public License
Jan Kratochvil 29d49d9
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
Jan Kratochvil 29d49d9
+
Jan Kratochvil 29d49d9
+# This file is part of the gdb testsuite.
Jan Kratochvil 29d49d9
+
Jan Kratochvil 29d49d9
+if {[skip_cplus_tests]} { continue }
Jan Kratochvil 29d49d9
+
Jan Kratochvil 29d49d9
+set testfile "pr12273"
Jan Kratochvil 29d49d9
+# Do NOT compile with debug flag.
Jan Kratochvil 29d49d9
+prepare_for_testing pr12273 $testfile $testfile.cc {c++}
Jan Kratochvil 29d49d9
+
Jan Kratochvil 29d49d9
+gdb_test_no_output "set language c++"
Jan Kratochvil 29d49d9
+
Jan Kratochvil 29d49d9
+# A list of minimal symbol names to check.
Jan Kratochvil 29d49d9
+# Note that GDB<char>::even_harder<int>(char) is quoted and includes
Jan Kratochvil 29d49d9
+# the return type.  This is necessary because this is the demangled name
Jan Kratochvil 29d49d9
+# of the minimal symbol.
Jan Kratochvil 29d49d9
+set min_syms [list \
Jan Kratochvil 29d49d9
+		  "GDB<int>::operator ==" \
Jan Kratochvil 29d49d9
+		  "GDB<int>::operator==(GDB<int> const&)" \
Jan Kratochvil 29d49d9
+		  "GDB<char>::harder(char)" \
Jan Kratochvil 29d49d9
+		  "GDB<int>::harder(int)" \
Jan Kratochvil 29d49d9
+		  {"int GDB<char>::even_harder<int>(char)"} \
Jan Kratochvil 29d49d9
+		  "GDB<int>::simple()"]
Jan Kratochvil 29d49d9
+
Jan Kratochvil 29d49d9
+foreach sym $min_syms {
Jan Kratochvil 29d49d9
+    if {[gdb_breakpoint $sym]} {
Jan Kratochvil 29d49d9
+	pass "setting breakpoint at $sym"
Jan Kratochvil 29d49d9
+    }
Jan Kratochvil 29d49d9
+}
Jan Kratochvil 29d49d9
+
Jan Kratochvil 29d49d9
+gdb_exit