[llvm-bugs] [Bug 46566] New: No diagnostic for no_unique_address extension on anonymous union

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Jul 2 14:05:07 PDT 2020


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

            Bug ID: 46566
           Summary: No diagnostic for no_unique_address extension on
                    anonymous union
           Product: clang
           Version: trunk
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++2a
          Assignee: unassignedclangbugs at nondot.org
          Reporter: hstong at ca.ibm.com
                CC: blitzrakete at gmail.com, erik.pilkington at gmail.com,
                    llvm-bugs at lists.llvm.org, richard-llvm at metafoo.co.uk

According to the 2020 DIS for C++, subclause 11.4 [class.mem] paragraph 13, the
attribute-specifier-seq of a member-declaration shall not be present when the
member-declarator-list is omitted.

Clang accepts such an attribute-specifier-seq and applies the associated
semantics with no diagnostic even in pedantic mode.

### SOURCE (<stdin>):
struct Empty {};
struct A {
  [[no_unique_address]] union {
    Empty emp [[no_unique_address]];
  };
  char x[3];
};
extern char szA[sizeof(A)];
extern char szA[3];


### COMPILER INVOCATION:
clang -cc1 -fsyntax-only -std=c++20 -Wall -Wextra -pedantic-errors -xc++ -


### ACTUAL OUTPUT:
(rc=0)


### EXPECTED OUTPUT:
Diagnostic message; a warning that is upgraded to an error.


### COMPILER VERSION INFO (clang++ -v):
clang version 11.0.0 (https://github.com/llvm/llvm-project.git
c5b4f03b53a48b7dc35ce6c345bb06871cd7699e)
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/004a9c9c/attachment.html>


More information about the llvm-bugs mailing list