[llvm-bugs] [Bug 47722] New: no_unique_address and has_unique_object_representations

via llvm-bugs llvm-bugs at lists.llvm.org
Sun Oct 4 09:22:28 PDT 2020


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

            Bug ID: 47722
           Summary: no_unique_address and
                    has_unique_object_representations
           Product: clang
           Version: 10.0
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++2a
          Assignee: unassignedclangbugs at nondot.org
          Reporter: kirshamir at gmail.com
                CC: blitzrakete at gmail.com, erik.pilkington at gmail.com,
                    llvm-bugs at lists.llvm.org, richard-llvm at metafoo.co.uk

>From StackOverflow (https://stackoverflow.com/q/64195712/2069064):

#include <type_traits>

struct Empty {};

struct A : public Empty {
    int x;
};

struct B {
    [[no_unique_address]] Empty e;
    int x;
};

static_assert (sizeof(A) == sizeof(int)); // ok
static_assert (sizeof(B) == sizeof(int)); // ok
static_assert(std::has_unique_object_representations_v<A>); // ok
static_assert(std::has_unique_object_representations_v<B>); // error

clang does not consider B to have unique object representations, but it should
here.

Note that a similar bug was opened on gcc:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97285

-- 
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/20201004/ee2d4f1a/attachment.html>


More information about the llvm-bugs mailing list