[Bug c++/106599] Wrong copy elision in delegating to copy-constructor

2022-08-22 Thread redi at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106599 --- Comment #5 from Jonathan Wakely --- This delegating constructor example seems like a third case of https://wg21.link/cwg2403

[Bug c++/106599] Wrong copy elision in delegating to copy-constructor

2022-08-22 Thread fchelnokov at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106599 --- Comment #4 from Fedor Chelnokov --- And if one deletes copy constructor of A: struct A { constexpr A() = default; constexpr A(const A&) = delete; constexpr A(int) : A(A()) {} }; A a(2); Then Clang rejects the program, b

[Bug c++/106599] Wrong copy elision in delegating to copy-constructor

2022-08-22 Thread redi at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106599 --- Comment #3 from Jonathan Wakely --- (In reply to Fedor Chelnokov from comment #0) > So we need to consider the constructors, and select A(const A&) : v(1) We do select that, but then for C++17 (and later) the copy is elided, which is permit

[Bug c++/106599] Wrong copy elision in delegating to copy-constructor

2022-08-22 Thread redi at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106599 Jonathan Wakely changed: What|Removed |Added CC||jlame646 at gmail dot com --- Comment

[Bug c++/106599] Wrong copy elision in delegating to copy-constructor

2022-08-12 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106599 --- Comment #1 from Andrew Pinski --- MSVC also rejects it.