<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/95361>95361</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            Structure generated by clang-cl.exe on Windows is incompatible with MSVC ABI
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          adisak
      </td>
    </tr>
</table>

<pre>
    I ran into an error in our codebase when mixing compilers. I have simplified the error to the reproducible example that follows.

The following code produces incompatible structures when compiled with MSVC vs clang-cl for Windows x64 target.

```
#include <iostream>
#include <xmmintrin.h>

typedef unsigned char u8;

struct __attribute__ ((ms_struct)) A
{
    u8      u8_1;
 int     i_1;
    __m128  vector_1;
protected:
    bool b_1;
};

struct B : public A
{
    void* pv_1;
};

struct C
{
    __m128 vector_1;
};

static_assert(std::is_pod<C>(), "__m128 is NOT POD");
static_assert(!std::is_pod<A>(), "A is POD");

int main()
{
    std::cout << "Size of A: " << sizeof(A) << "\n";
 std::cout << "Size of B: " << sizeof(B) << "\n";
    return 0;
}
```

The MSVC program has this output:

```
Size of A: 48
Size of B: 64
```
While the clang-cl program has the following output:

```
Size of A: 48
Size of B: 48
```
According to LLVM/clang documentation, clang-cl aims to be [ABI compatible with MSVC on Windows](https://clang.llvm.org/docs/MSVCCompatibility.html) but this doesn't appear to be the case. Is this a bug in clang-cl?

Is there a way to make clang-cl and MSVC generate the same layout for these structures?
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJysVU2P2zgM_TXKhWgQy7HjHHxwkg0wQLtdYIr2GMgSE2srS4Y-kkl__UK28zWTRfewgGHDIvX4yEdRzDl50IglyVYk20xY8I2xJRPSsZ-T2ohz-QKWaZDaG2Aa0FpjQWowwQI3AmvmEE4Namjlm9QH4KbtpELrpvACDTsiONl2Su4lCvANjhDe9D8WO2tE4LJWCPjG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