https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88337

--- Comment #6 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
First steps: this now compiles in c++2a:

struct B {
  virtual void baz () {}
};

struct D : B { };

constexpr bool
fn ()
{
  bool ok = true;
  B b;
  B *b1 = &b;
  if (D *pd = dynamic_cast<D*>(b1))
    ok = false;

  D d;
  B *b2 = &d;
  if (D *pd = dynamic_cast<D*>(b2))
    /*OK*/;
  else
   ok = false;

  return ok;
}

static_assert(fn ());

Reply via email to