[Bug c++/104282] Copy elision when initializing a base-class subobject with aggregate initialization
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104282 --- Comment #8 from Fedor Chelnokov --- One more inconsistency here: struct A { A() {} A(A&&) = delete; }; struct B : A { }; int main() { // ok in GCC B{ A{} }; // error in GCC B b{ A{} }; } GCC allows temporary creation B{ A{} }, but prohibits variable creation B b{ A{} }. Online demo: https://gcc.godbolt.org/z/YGjYYqo6M It looks like both must be prohibited as in Clang (or both allowed as in MSVC). Related discussion: https://stackoverflow.com/q/70898525/7325599
[Bug c++/104282] Copy elision when initializing a base-class subobject with aggregate initialization
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104282 --- Comment #7 from Andrew Pinski --- (In reply to Jonathan Wakely from comment #4) > I think there's any existing bug about this, and it's an open issue in the > ABI PR 98995 .
[Bug c++/104282] Copy elision when initializing a base-class subobject with aggregate initialization
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104282 --- Comment #6 from Andrew Pinski --- http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_active.html#2403
[Bug c++/104282] Copy elision when initializing a base-class subobject with aggregate initialization
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104282 --- Comment #5 from Jonathan Wakely --- Related to https://github.com/itanium-cxx-abi/cxx-abi/issues/107
[Bug c++/104282] Copy elision when initializing a base-class subobject with aggregate initialization
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104282 --- Comment #4 from Jonathan Wakely --- I think there's any existing bug about this, and it's an open issue in the ABI
[Bug c++/104282] Copy elision when initializing a base-class subobject with aggregate initialization
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104282 --- Comment #3 from Fedor Chelnokov --- Both Clang and GCC do not change their output either with `-std=c++20` or with `-std=c++17` options. And both reject the program with -std=c++14`.
[Bug c++/104282] Copy elision when initializing a base-class subobject with aggregate initialization
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104282 --- Comment #2 from Andrew Pinski --- That is c++17 requires Copy elision here while c++14 does not.
[Bug c++/104282] Copy elision when initializing a base-class subobject with aggregate initialization
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104282 --- Comment #1 from Andrew Pinski --- Gcc 12 defaults to c++17. I have not looked but I suspect that is the difference.