c++/24367: Infinite recursion of typedef substitution
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.cp / oranking.cc
index dc1972a3da30e037832c15927625d734905b5c69..135761016cc5ea21a816d7547c6741ac27930598 100644 (file)
@@ -1,3 +1,18 @@
+#include <cstdlib>
+
+/* Make sure `malloc' is linked into the program.  If we don't, tests
+   in the accompanying expect file may fail:
+
+   evaluation of this expression requires the program to have a function
+   "malloc".  */
+
+void
+dummy ()
+{
+  void *p = malloc (16);
+
+  free (p);
+}
 
 /* 1. A standard covnersion sequence is better than a user-defined sequence
       which is better than an elipses conversion sequence.  */
@@ -147,7 +162,26 @@ int test14 (){
   return foo14(e); // 46
 }
 
+/* Test cv qualifier overloads.  */
+int foo15 (char *arg) { return 47; }
+int foo15 (const char *arg) { return 48; }
+int foo15 (volatile char *arg) { return 49; }
+int foo15 (const volatile char *arg) { return 50; }
+static int
+test15 ()
+{
+  char *c = 0;
+  const char *cc = 0;
+  volatile char *vc = 0;
+  const volatile char *cvc = 0;
+
+  // 47 + 48 + 49 + 50 = 194
+  return foo15 (c) + foo15 (cc) + foo15 (vc)  + foo15 (cvc);
+}
+
 int main() {
+  dummy ();
+
   B b;
   foo0(b);
   foo1(b);
@@ -203,5 +237,10 @@ int main() {
   foo14(e);
   test14();
 
+  const char *cc = 0;
+  volatile char *vc = 0;
+  const volatile char *cvc = 0;
+  test15 ();
+
   return 0; // end of main
 }
This page took 0.025502 seconds and 4 git commands to generate.