| Issue |
86643
|
| Summary |
Inconsistent application of base class copy elision
|
| Labels |
new issue
|
| Assignees |
|
| Reporter |
Fedr
|
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
```
B
---
B
```
So they perform base class copy elision (which I known is questionable).
And Clang prints:
```
B
---
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?
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs