<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 - MS __declspec(empty_bases) generates error with virtual inheritance"
   href="https://bugs.llvm.org/show_bug.cgi?id=37015">37015</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>MS __declspec(empty_bases) generates error with virtual inheritance
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>6.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++
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>soumi.manna@intel.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>dgregor@apple.com, llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>The below program fails to generate correct size of Derived class when
__declspec(empty_bases) is applied on virtual inheritance. Microsoft compiler
compiles the test. 

bash-3.2$ cat test.cpp
struct Empty1 {};
struct Empty2 {};

struct __declspec(empty_bases) Derived : virtual Empty2
{
};
static_assert(sizeof(Derived) == 8, "Derived should be 8 byte");

struct Derived1 : virtual Derived, virtual Empty1
{
};
static_assert(sizeof(Derived1) == 16, "Derived1 should be 16 byte");


bash-3.2$ clang -c test.cpp
test.cpp:12:1: error: static_assert failed "Derived1 should be 16 byte"
static_assert(sizeof(Derived1) == 16, "Derived1 should be 16 byte");
^             ~~~~~~~~~~~~~~~~~~~~~~
1 error generated.

bash-3.2$ cl -c test.cpp
Microsoft (R) C/C++ Optimizing Compiler Version 19.00.24210 for x64
Copyright (C) Microsoft Corporation.  All rights reserved.

test.cpp</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>