summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.old-deja/g++.mike/dyncast8.C
blob: e2c5a2df9a60de75abd8cd5568c24297d23dccf6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// { dg-do run  }
#include <typeinfo>

class Base
{
public:
  virtual ~Base() { }
};

class Derived : public Base
{
public:
    Derived() {}
};

int main()
{
    const Derived b;
    const Base*   ap = &b;

    const Derived* p1 = dynamic_cast<const Derived*>(ap);
    return p1 == 0;
}