<html><head></head><body><div style="font-family: Verdana;font-size: 12.0px;"><div>
<div>Hello UB-Experts,</div>

<div>&nbsp;</div>

<div>as far as I can see the following (static_cast) is UB:</div>

<div>&nbsp;</div>

<div>struct B {</div>

<div>&nbsp; int i;</div>

<div>};</div>

<div>&nbsp;</div>

<div>struct D : B {</div>

<div>&nbsp; void foo() { /* access B::i */ }</div>

<div>};</div>

<div>&nbsp;</div>

<div>B b;</div>

<div>static_cast&lt;D&amp;&gt;(b).foo();</div>

<div>&nbsp;</div>

<div>because of [expr.static.cast] clause 11</div>

<div>&nbsp;</div>

<div>first question: is my assessment of the situation correct or is this use legal?</div>

<div>if it is not (legal): could we make it legal or would we run afoul of the aliasing rules?</div>

<div>&nbsp;</div>

<div>best regards</div>

<div>&nbsp;</div>

<div>Fabio</div>
</div></div></body></html>