https://bugs.llvm.org/show_bug.cgi?id=48904

            Bug ID: 48904
           Summary: clang-cl disallows C11 convenience macro static_assert
                    in the function scope
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangb...@nondot.org
          Reporter: w...@google.com
                CC: htmldevelo...@gmail.com, llvm-bugs@lists.llvm.org,
                    neeil...@live.com, nicolaswe...@gmx.de,
                    richard-l...@metafoo.co.uk

Created attachment 24427
  --> https://bugs.llvm.org/attachment.cgi?id=24427&action=edit
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
https://github.com/ionescu007/minlzma/issues/1.

Here is a reduced test-case:

C:\src\build>clang-cl --version
clang version 12.0.0 (https://github.com/llvm/llvm-project/
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.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to