summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.old-deja/g++.eh/catch10.C
blob: 2300a9461870d73b0c5d2ff1003473ce1adf6770 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// { dg-do assemble  }
// Test that we notice unfortunate handler ordering.

struct A { };
struct B: public A { };
struct C: private A { };

void f();
void g()
{
  try { f(); }
  catch (...) { }		// { dg-error "" } ... followed by others
  catch (A*) { }

  try { f(); }
  catch (A*) { }		// { dg-warning "" } A* before B*
  catch (B*) { }		// { dg-warning "" } A* before B*

  try { f(); }
  catch (A*) { }
  catch (C*) { }		// no warning; A is private base
}