[llvm-bugs] [Bug 46562] New: Clang fails to parse C++11 attributes for unnamed bit-fields

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Jul 2 12:59:17 PDT 2020


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

            Bug ID: 46562
           Summary: Clang fails to parse C++11 attributes for unnamed
                    bit-fields
           Product: clang
           Version: trunk
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++11
          Assignee: unassignedclangbugs at nondot.org
          Reporter: hstong at ca.ibm.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

A short test shows that Clang does not accept attributes before the colon (`:`)
for bit-fields when the identifier is omitted.

### SOURCE (<stdin>):
struct A {
  int x, [[]] : 0;
};


### COMPILER INVOCATION:
clang -cc1 -fsyntax-only -xc++ -


### ACTUAL OUTPUT:
<stdin>:2:10: error: an attribute list cannot appear here
  int x, [[]] : 0;
         ^~~~
<stdin>:2:15: error: expected member name or ';' after declaration specifiers
  int x, [[]] : 0;
  ~~~         ^
2 errors generated.


### EXPECTED OUTPUT:
(rc=0)


### COMPILER VERSION INFO (clang++ -v):
clang version 11.0.0 (https://github.com/llvm/llvm-project.git
f9348f70c2330f3565ee01134bcba1dd38628c79)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /opt/wandbox/clang-head/bin
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5.5.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6.5.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/7
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/7.5.0
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5.5.0
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Candidate multilib: x32;@mx32
Selected multilib: .;@m64

-- 
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/20200702/78b47e81/attachment.html>


More information about the llvm-bugs mailing list