Why does this fail without static_cast?
<p>Compiling <em>f</em> works, but compiling <em>g</em> fails with an error. </p>

<p>Why does this happen?</p>

<pre><code>class A {
public:
  A() {}
};

class B : public A {
public:
  B() {}
};

void f() {
  A* a = new A();
  B* b = static_cast&lt;B*&gt;(a);
}

void g() {
  A* a = new A();
  B* b = a;
}
</code></pre>
