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

    <tr>
        <th>Summary</th>
        <td>
            Inconsistent application of base class copy elision
        </td>
    </tr>

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

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

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

<pre>
    In this program:
```
#include <iostream>

struct A {};

struct B {
  B() { std::cout << "B "; } 
  B(B&&) { std::cout << "Bmove "; } 
};

struct C : A, B {};

int main() {
    [[maybe_unused]] C x{ {},  {} };
 std::cout << "\n---\n";
    [[maybe_unused]] C y{ {}, B{} };
}
```
both GCC and MSVC print
```

---

```
So they perform base class copy elision (which I known is questionable).

And Clang prints:
```

---
B Bmove 
```
Online demo: https://gcc.godbolt.org/z/dozGhv5q7

Why copy elision is applied in one case but not in the other? Could you please explain this inconsistency?
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyMVE9vgzYU_zSPy1MiYiCEA4dARtXDtEOl7TgZ-zV4MzbFpi399JMJU9M20SZZtnn_fr_3B3Pn1NkQlZBVkJ0iPvnOjmVDcoxaK-fy0aDvlMNhtOeR95AcIT5BfIR9vK7LJ0uUEXqShJDUyjo_UrD-ZVUvu_PjJDweEfIK8hMk1Q1ttWgXCWIF7ACsCCJ0Xgb05Cjs5AMKJDUCY1XYIAl-J7x2rIDtl_Uf_r19pZ8x7hKsEZIjHoHVK9cfhsp47Lkyn-T_pYW41Lnq-dzSn5OZHEnITpCdsMb3wHINyGpcr3gd_24SkNVms9mE45LJ_0KcvyJWNxDD_VbDW-s7fKhr5Ebir0-_1ziMyvibttVa0kDwi-Cb3ZNF39GMA43Pduyx5Y5QaO4cCjvMSFo5ZQ0CO7x1SnT4iH8b-2ZQOXyZyHllDW81ASu21_04Gom15uZ84ejuDfENnutw3LL-zWhlCCX1NgxE5_2wRGYNsOYsxPZsZWu139rxDKz5ANZI-_HQvWYv-TW7P7r5a3rKIR8GrUiiMmgNoQiFaCePxvog8x2h9R2NkDRY20lLnO2Eg6ZgSO-D5mr9b5UR1jjlPBkxQ9JEskxkkRQ8onKX73ZpmmSsiLpS5LJlXGRFygTFaVbIglgs4paznHYyjVTJYpbGCdvHh-yQFtt0z4o2b9N9lu7yXc4gjannSm-1fu1D1pFybqLysN-nSaR5S9ot7wxjht5wUS6je4rGMvhs2unsII21ct59RvHKayofPxPxl_oIHhqO9vneoETTqMtvfVG-m9qtsD2wJiCsx2YY7V8kPLBm4eWANQvvfwIAAP__-J5w8w">