Accessing same-type inactive member in unions : <p>I have something like this:</p>

<pre><code>union DataXYZ
{
    struct complex_t
    {
        float real, imag;
    } complex;

    struct vector_t
    {
        float magnitude, phase;
    } vector;
};
</code></pre>

<p>I have some vectors of these, being general-purpose workspace memory, where I use the fields accordingly after the semantic context. </p>

<p>I know it's undefined behaviour to read a field in a union, when the last active member was another field (and type?). Does this matter when the types and layout match exactly?</p>

<p>I've been commenting on some other similar questions, asking for references that guarantee the behaviour, but nothing came up yet - hence this question.</p>
