title: Structure member alignment with _Alignas
body: <p>I was wondering about the following: is the new <code>_Alignas</code> alignment
  specifier in C11 applicable to structure members?</p>
  
  <p>I've always assumed that much, but a thorough reading of the N1570
  public draft seems to indicate that an <em>alignment-specifier</em> cannot
  appear in a <em>specifier-qualifier-list</em>, which is where I'd expect it
  to be, if it were supported. I've read the grammar a couple of times
  but can't figure out how <code>_Alignas</code> is supposed to be permitted in
  a structure member declaration.</p>
  
  <p>However, it seems to me that the intent of the standard is that
  <code>_Alignas</code> should be applicable to structure members as the paragraph
  on <code>_Alignas</code> (§ 6.7.5) states that "an alignment attribute shall not
  be specified in a declaration of [...] a bit-field". Given that
  the term "bit-field" is defined in § 6.7.2.1 to be a structure
  member (precise wording: "such a member is called a <em>bit-field</em>"),
  I had always interpreted that sentence to implicitly mean alignment
  specifiers were allowed for non-bit-field members.</p>
  
  <p>Checking against existing implementations shows that both Clang 3.0
  and GCC 4.7 support <code>_Alignas</code> on structure members without
  complaining (with <code>-pedantic</code>). The Clang source code reproduces the
  same grammar from N1570, except <code>Parser::ParseSpecifierQualifierList</code>
  allows alignment specifiers; the function does contain a TODO element,
  though, that reads:</p>
  
  <pre><code>/// TODO: diagnose attribute-specifiers and alignment-specifiers.
  </code></pre>
  
  <p>The GCC C parser code appears to be similar, i.e. even though it quotes
  the standard grammar, it allows alignment specifiers in
  specifier-qualifier lists.</p>
  
  <p>I've also checked the list of known defects, as well as comp.lang.c
  and comp.std.c, to see if the topic had been raised there but it
  doesn't appear to be the case. Hence, my question: are alignment
  specifiers supposed to be allowed on structure members?</p>
  
  <p>EDIT: The relevant grammar rules are:</p>
  
  <pre><code>// Compare this...
  (6.7) declaration-specifiers:
             storage-class-specifier declaration-specifiers_opt
             type-specifier declaration-specifiers_opt
             type-qualifier declaration-specifiers_opt
             function-specifier declaration-specifiers_opt
             // This seems to be the only place that mentions
             // alignment-specifier on the rhs of a rule.
             alignment-specifier declaration-specifiers_opt
  
  (6.7.2.1) struct-or-union-specifier:
             struct-or-union identifier_opt { struct-declaration-list }
             struct-or-union identifier
  
  (6.7.2.1) struct-declaration-list:
             struct-declaration
             struct-declaration-list struct-declaration
  
  (6.7.2.1) struct-declaration:
             specifier-qualifier-list struct-declarator-list_opt ;
             static_assert-declaration
  
  // ...to this.
  (6.7.2.1) specifier-qualifier-list:
             type-specifier specifier-qualifier-list_opt
             type-qualifier specifier-qualifier-list_opt
             // Missing alignment-specifier specifier-qualifier-list_opt?
  
  (6.7.5) alignment-specifier:
            _Alignas ( type-name )
            _Alignas ( constant-expression )
  </code></pre>