struct B {};
struct D : public B {};

typedef int B::*bm;
typedef int D::*dm;

bm bp;

void f() {
  const_cast<dm>(bp); // { dg-error "" }
}


syntax highlighted by Code2HTML, v. 0.9.1