- Notifications
You must be signed in to change notification settings - Fork 15.1k
Description
| Bugzilla Link | 48904 |
| Resolution | FIXED |
| Resolved on | Jan 29, 2021 22:22 |
| Version | unspecified |
| OS | Windows NT |
| Blocks | #48246 |
| Attachments | reduced test-case |
| Reporter | LLVM Bugzilla Contributor |
| CC | @nico,@zygoloid,@tstellar |
| Fixed by commit(s) | 764a7a2 8c5d184 |
Extended Description
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 ionescu007/minlzma#1.
Here is a reduced test-case:
C:\src\build>clang-cl --version
clang version 12.0.0 (https://github.com/llvm/llvm-project/ 6de4865)
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.