<html>
    <head>
      <base href="http://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - _Alignas handling rejects tentative definitions with no alignment specifier"
   href="http://llvm.org/bugs/show_bug.cgi?id=20688">20688</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>_Alignas handling rejects tentative definitions with no alignment specifier
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Windows NT
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Frontend
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>hstong@ca.ibm.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>There is a rule in C11 subclause 6.7.5 paragraph 7 that if the definition of an
object does not have an alignment specifier, then any other declaration of that
object shall also have no alignment specifier.

Clang attempts to produce a diagnostic for that rule although it is not a
constraint (that is, no diagnostic is required). Unfortunately, the
implementation of the diagnostic is problematic. It treats tentative
definitions as definitions in their own right.

The ability for there to be multiple tentative definitions for the same object
means that applying the rule regarding "the" definition upon a tentative
definition does not make sense.

### SOURCE:
$ cat tentativeDefinitionNotADefinition.c 
char _Alignas(int) c = 'a';
char c;


### COMPILER INVOCATION AND OUTPUT:
$ clang -cc1 -x c -std=c11 tentativeDefinitionNotADefinition.c 
tentativeDefinitionNotADefinition.c:2:6: error: '_Alignas' must be specified on
definition if it is specified on any declaration
char c;
     ^
tentativeDefinitionNotADefinition.c:1:6: note: declared with '_Alignas'
attribute here
char _Alignas(int) c = 'a';
     ^
1 error generated.


### EXPECTED OUTPUT:
No diagnostic.


### COMPILER VERSION INFO:
$ clang -v
clang version 3.5.0 (trunk 214060)
Target: x86_64-unknown-linux-gnu
Thread model: posix
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8.2
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9.0
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8
Candidate multilib: .;@m64
Selected multilib: .;@m64</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>