On 12/11/2008, James Dennett <[EMAIL PROTECTED]> wrote: > In a union only one field can be active at one time, hence > initializing more than one makes no sense > ... > However, const items need to be initialized, hence potting two in a > union makes no sense.
Conceptually there is nothing wrong with having two or more const members in a union. The compiler (or standard) should recognise this particular case, and interpret that initialising one member of a union is equivalent to initialising all the members, be they const or not. > (The standard doesn't need an explicit rule to say that, as it's > implied by other rules.) I'm not sure I agree with the standard. The two requirements, i.e. (i) need to initialise all consts, and (ii) only one member of a union can be initialised, are at conflict with each other. Requirement (ii) fullfills requirement (i), so the compiler shouldn't be complaining about uninitialised consts.