summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.old-deja/g++.other/dcast2.C
blob: 0f08e066e669c0688af86ac3512c69e4ad5203c4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// { dg-do assemble  }

// Based on a testcase by Ruslan Shevchenko <Ruslan@Shevchenko.Kiev.UA>

struct B {
  virtual ~B();
};

struct D : public B {
};

void foo() {
  B x;
  dynamic_cast<D*>(&x); // { dg-warning "" } will never succeed
  B* p = &x;
  dynamic_cast<D*>(p);
}