[llvm-bugs] [Bug 48904] New: clang-cl disallows C11 convenience macro static_assert in the function scope

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Jan 27 13:14:03 PST 2021


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: unassignedclangbugs at nondot.org
          Reporter: wtc at google.com
                CC: htmldeveloper at gmail.com, llvm-bugs at lists.llvm.org,
                    neeilans at live.com, nicolasweber at gmx.de,
                    richard-llvm at 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20210127/cb846246/attachment.html>


More information about the llvm-bugs mailing list