[llvm-bugs] [Bug 50954] New: C2x attributes on array declarators handled incorrectly

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Jul 1 03:55:07 PDT 2021


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

            Bug ID: 50954
           Summary: C2x attributes on array declarators handled
                    incorrectly
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C
          Assignee: unassignedclangbugs at nondot.org
          Reporter: aaron at aaronballman.com
                CC: blitzrakete at gmail.com, dgregor at apple.com,
                    erik.pilkington at gmail.com, llvm-bugs at lists.llvm.org,
                    richard-llvm at metafoo.co.uk

Consider the following:
```
void func(void) {
  int a[10] [[maybe_unused]], b;
}
```
The declaration of `a` should not be accepted in C++ or C mode because the
attribute in that position appertains to the array type (6.7.6.2p3,
[dcl.array]p3).

In C++ mode, we reject this code as the attribute does not apply to types, but
we accept the code in C mode.

https://godbolt.org/z/9n3azao7f

-- 
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/20210701/facac463/attachment.html>


More information about the llvm-bugs mailing list