summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/eh/shadow1.C
blob: 15f666a2cfe27201c85cbdc0bec206900ccf4d03 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
// Copyright (C) 2004 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 15 Oct 2004 <nathan@codesourcery.com>

// We forgot to ignore current context and friends when determing
// which exceptions shadowed eachother.

struct E;

struct B {};

struct D : private B
{
  friend class E;
  
  static B *baz (D *);
  virtual void V () throw (B);  // { dg-error "overriding" "" }
};

struct E : public D
{
  virtual void V () throw (D); // { dg-error "looser throw" "" }
};

B* foo (D *);

B *D::baz (D *p)
{
  try {foo (p);}
  catch (B const &b) {}
  catch (D const &d) {}
  return p;
}