title: _Alignas for struct members using clang & C11
body: <p>I'm having some trouble with -Wpadded using C11 and structs.</p>
  
  <p>I've already read <a href="https://stackoverflow.com/questions/10676827/structure-member-alignment-with-alignas">Structure member alignment with _Alignas</a>, and I looked in the clang docs and saw that it IS supported now.</p>
  
  <p>Also, I'm using a very new version of clang that I built from trunk recently.</p>
  
  <pre><code>$ clang --version
  clang version 3.3 (trunk 175473)
  Target: x86_64-unknown-linux-gnu
  Thread model: posix
  </code></pre>
  
  <p>The problem I'm running into is this:</p>
  
  <pre><code>#include &lt;stdlib.h&gt;
  #include &lt;stdalign.h&gt;
  
  struct foo{
     void* a;
     int b;
  };
  
  int main() {
     struct foo instance;
  
     instance.a = NULL;
     instance.b = 2;
  
     return 0;
  }
  </code></pre>
  
  <p>Which throws me this warning: </p>
  
  <pre><code>$ clang -Weverything -std=c11 t.c 
  t.c:4:8: warning: padding size of 'struct foo' with 4 bytes to alignment boundary [-Wpadded]
  struct foo{
         ^
  1 warning generated.
  </code></pre>
  
  <p>Now isn't this what <code>_Alignas</code> is for? I tried putting it before the int member declaration, like so:</p>
  
  <pre><code>struct foo{
     void* a;
     _Alignas(void*) int b;
  };
  </code></pre>
  
  <p>But the same warning remains. I also tried putting the _Alignas in various places, to no avail. What am I missing here? </p>
  
  <p>I know I could just ignore this particular warning and I understand why padding is important, so I'm not interested in workarounds or explanations about what padding is. I want to know how to change my C in a portable, standards conformant way so that the warning is no longer emitted.</p>