<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - no_unique_address and has_unique_object_representations"
   href="https://bugs.llvm.org/show_bug.cgi?id=47722">47722</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>no_unique_address and has_unique_object_representations
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>10.0
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Windows NT
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>C++2a
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>kirshamir@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>blitzrakete@gmail.com, erik.pilkington@gmail.com, llvm-bugs@lists.llvm.org, richard-llvm@metafoo.co.uk
          </td>
        </tr></table>
      <p>
        <div>
        <pre>From StackOverflow (<a href="https://stackoverflow.com/q/64195712/2069064">https://stackoverflow.com/q/64195712/2069064</a>):

#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:
<a href="https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97285">https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97285</a></pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>