summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/rtti/dyncast4.C
blob: 2a5fd2b3b96190d386ad1568741397fa118a12f7 (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
// Test to make sure that we keep searching if we don't find the type we
// want at the expected address.

// { dg-do run }

struct A
{
  virtual void f() {};
};

struct B: A { };

struct C: A { };

struct D: B, C { };

int main()
{
  D d;
  A* ap = static_cast<B*>(&d);
  C* cp = dynamic_cast<C*>(ap);
  if (cp == 0)
    return 1;
  else
    return 0;
}