OSDN Git Service

* g++.old-deja/g++.eh/catch11.C: New test.
authornathan <nathan@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 25 May 2000 11:16:11 +0000 (11:16 +0000)
committernathan <nathan@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 25 May 2000 11:16:11 +0000 (11:16 +0000)
* g++.old-deja/g++.eh/catch12.C: New test.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@34164 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/testsuite/ChangeLog
gcc/testsuite/g++.old-deja/g++.eh/catch11.C [new file with mode: 0644]
gcc/testsuite/g++.old-deja/g++.eh/catch12.C [new file with mode: 0644]

index 1ec64a2..ccdc8dd 100644 (file)
@@ -1,3 +1,8 @@
+2000-05-25  Nathan Sidwell  <nathan@codesourcery.com>
+
+       * g++.old-deja/g++.eh/catch11.C: New test.
+       * g++.old-deja/g++.eh/catch12.C: New test.
+
 2000-05-24  Nick Clifton  <nickc@cygnus.com>
 
        * gcc.c-torture/execute/20000523-1.c: New test.
diff --git a/gcc/testsuite/g++.old-deja/g++.eh/catch11.C b/gcc/testsuite/g++.old-deja/g++.eh/catch11.C
new file mode 100644 (file)
index 0000000..298dd03
--- /dev/null
@@ -0,0 +1,63 @@
+// Copyright (C) 2000 Free Software Foundation, Inc.
+// Contributed by Nathan Sidwell 24 May 2000 <nathan@codesourcery.com>
+
+// we should be able to catch a base a virtual, provided it is accessible by at
+// least one public path
+// -- public, << private, == virtual
+// E<<B==A
+// +--C==A
+// +<<D==A
+
+struct A {};
+struct B : virtual A {};
+struct C : virtual A {};
+struct D : virtual A {};
+struct E : private B, public C, private D {};
+
+extern "C" void abort ();
+
+void fne (E *e)
+{
+  throw e;
+}
+
+void check(E *e)
+{
+  int caught;
+  
+  caught = 0;
+  try { fne(e); }
+  catch(A *p) { caught = 1; if (p != e) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+
+  caught = 0;
+  try { fne(e); }
+  catch(B *p) { abort ();}
+  catch(...) { caught = 1; }
+  if (!caught) abort();
+
+  caught = 0;
+  try { fne(e); }
+  catch(C *p) { caught = 1; if (p != e) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+
+  caught = 0;
+  try { fne(e); }
+  catch(D *p) { abort ();}
+  catch(...) { caught = 1; }
+  if (!caught) abort();
+
+  return;
+}
+
+int main ()
+{
+  E e;
+  
+  check (&e);
+  check ((E *)0);
+
+  return 0;
+}
diff --git a/gcc/testsuite/g++.old-deja/g++.eh/catch12.C b/gcc/testsuite/g++.old-deja/g++.eh/catch12.C
new file mode 100644 (file)
index 0000000..b174019
--- /dev/null
@@ -0,0 +1,63 @@
+// Copyright (C) 2000 Free Software Foundation, Inc.
+// Contributed by Nathan Sidwell 24 May 2000 <nathan@codesourcery.com>
+
+// we should be able to catch a base a virtual, provided it is accessible by at
+// least one public path
+// -- public, << private, == virtual
+// E--B<<==A
+// +--C--==A
+// +--D<<==A
+
+struct A {};
+struct B : private virtual A {};
+struct C : virtual A {};
+struct D : private virtual A {};
+struct E : public B, public C, public D {};
+
+extern "C" void abort ();
+
+void fne (E *e)
+{
+  throw e;
+}
+
+void check(E *e)
+{
+  int caught;
+  
+  caught = 0;
+  try { fne(e); }
+  catch(A *p) { caught = 1; if (p != e) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+
+  caught = 0;
+  try { fne(e); }
+  catch(B *p) { caught = 1; if (p != e) abort();}
+  catch(...) { abort (); }
+  if (!caught) abort();
+
+  caught = 0;
+  try { fne(e); }
+  catch(C *p) { caught = 1; if (p != e) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+
+  caught = 0;
+  try { fne(e); }
+  catch(D *p) { caught = 1; if (p != e) abort ();}
+  catch(...) { abort (); }
+  if (!caught) abort();
+
+  return;
+}
+
+int main ()
+{
+  E e;
+  
+  check (&e);
+  check ((E *)0);
+
+  return 0;
+}