<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/55017>55017</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            C: Non standard compliant behavior in strict standard mode
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          DaKnig
      </td>
    </tr>
</table>

<pre>
    the following program compiles, with `clang --std=c18`, when according to the standard it should not:
```
;
int main() {}
```
notice that the `;` is in the top level of the translation unit. according to the standard:
```
translation-unit:
    (basically a list of at least one external-declaration)

external-declaration:
    function-definition
    declaration

function-definition:
    declaration-specifiers declarator declaration-listopt compound-statement
    (compound-statement *must* contain {} therefore ';' can't be part of this rule since there's no {} there)

declaration:
    declaration-specifiers init-declarator-list (optional) ;
    static_assert-declaration

declaration-specifiers:
    (contains at least one token out of a huge list)
    (therefore can't be empty therefore can't possibly be the empty ';')

static_assert-declaration:
    _Static_assert '(' constant-expression , string-literal ')' ;
    (obviously can't be that)
```
an empty `;` is not a static_assert-declaration and can't be a declaration - those must contain at least one token (some specifier).
it can't be a function definition, as that would end with `}`.
therefore it cannot be `external-declaration`, therefore it cannot be one of the variants of `translation-unit`.
if anything, it must appear inside a function.

an empty `;` is a null-statement; it can't happen outside functions, on the top level.

- obtained `clang-13.0.0-3` from the fedora repositories
- running fedora 35
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJx1VdGOqzgM_Rr6YlFRmJb2gYeZW83LSvuyH3AViIHshgQlYebO36-dUkpn2qpqIYmP7eNjp7byqwo9Qmu1tp_KdDA62zkxQGOHUWn0Sf4LPlXoITlkjRZ0Ik19kElxbnZHWov7PRoQTWOdZIhggTF9EEYKJ0EF8L2dtARjQ1K8Jtk5yV7Z9vK9vBZvlwdlAgxCmSQ_JvkJkvItKc8PTQhNNUi-RIgOeYNQDhko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