Doc. no.: WG14/N1532
Date: 2010-11-03
Reply to: Clark Nelson
Phone: +1-503-712-8433
Email: [email protected]

Small fix for the effect of alignment on struct/union type compatibility

When I originally translated the alignment proposal from C++ for C, I forgot about the fact that C (unlike C++) has some degree of structural compatibility for struct and union types. This can be fixed quite simply.

Change 6.2.7p1:

... If one is declared with a tag, the other shall be declared with the same tag. If both are completed anywhere within their respective translation units, then the following additional requirements apply: there shall be a one-to-one correspondence between their members such that each pair of corresponding members are declared with compatible types, and such that if one member of a corresponding pair is declared with an alignment specifier, the other member is declared with an equivalent alignment specifier, and such that if one member of a corresponding pair is declared with a name, the other member is declared with the same name. For two structures, corresponding members shall be declared in the same order....