<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </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 - clang-cl disallows C11 convenience macro static_assert in the function scope"
   href="https://bugs.llvm.org/show_bug.cgi?id=48904">48904</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>clang-cl disallows C11 convenience macro static_assert in the function scope
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>unspecified
          </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>-New Bugs
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>wtc@google.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>htmldeveloper@gmail.com, llvm-bugs@lists.llvm.org, neeilans@live.com, nicolasweber@gmx.de, richard-llvm@metafoo.co.uk
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=24427" name="attach_24427" title="reduced test-case">attachment 24427</a> <a href="attachment.cgi?id=24427&action=edit" title="reduced test-case">[details]</a></span>
reduced test-case

The clang-cl compiler disallows C11 convenience macro static_assert in the
function scope. It does allow static_assert in the file scope.

This problem is also reported in
<a href="https://github.com/ionescu007/minlzma/issues/1">https://github.com/ionescu007/minlzma/issues/1</a>.

Here is a reduced test-case:

C:\src\build>clang-cl --version
clang version 12.0.0 (<a href="https://github.com/llvm/llvm-project/">https://github.com/llvm/llvm-project/</a>
6de4865545da73687dd6d28d153cd345ed5e7918)
Target: x86_64-pc-windows-msvc
Thread model: posix
InstalledDir: C:\src\chromium\src\third_party\llvm-build\Release+Asserts\bin

C:\src\build>type static-assert.c
#include <assert.h>

_Static_assert(1 == 1, "");
static_assert(1 == 1, "");

void Foo(void) {
  _Static_assert(1 == 1, "");
  static_assert(1 == 1, "");
}
C:\src\build>clang-cl /s static-assert.c
clang-cl: error: no such file or directory: '/s'

C:\src\aom.1\build.clang-cl>clang-cl /c static-assert.c
static-assert.c(8,3): error: expected expression
  static_assert(1 == 1, "");
  ^
1 error generated.</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>