public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
* [Bug c++/76262] list-initialization prefers initializer_list over copy constructor [not found] <bug-76262-4@http.gcc.gnu.org/bugzilla/> @ 2021-03-17 14:10 ` arthur.j.odwyer at gmail dot com 2021-03-17 16:21 ` redi at gcc dot gnu.org 2021-03-17 16:26 ` redi at gcc dot gnu.org 2 siblings, 0 replies; 3+ messages in thread From: arthur.j.odwyer at gmail dot com @ 2021-03-17 14:10 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=76262 Arthur O'Dwyer <arthur.j.odwyer at gmail dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |arthur.j.odwyer at gmail dot com --- Comment #5 from Arthur O'Dwyer <arthur.j.odwyer at gmail dot com> --- GCC still has the buggy behavior as of 2021. This bug should be reopened. GCC's behavior here disagrees with all of Clang, ICC, MSVC, and common sense. // https://godbolt.org/z/GKxh8P struct A {}; struct B { B(const B&); explicit B(std::initializer_list<A>); operator A() const; }; extern B b; void test() { auto a{b}; // constructs as if by `B a = { static_cast<A>(b) }`, not `B a = b` } I recently observed real teaching materials claiming that brace-initialization didn't work for copies -- if you want to invoke the copy constructor you MUST use parentheses -- and giving essentially this bug as the reason. (They apparently didn't realize that this behavior was unique to GCC, and the subject of a bug report.) ^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug c++/76262] list-initialization prefers initializer_list over copy constructor [not found] <bug-76262-4@http.gcc.gnu.org/bugzilla/> 2021-03-17 14:10 ` [Bug c++/76262] list-initialization prefers initializer_list over copy constructor arthur.j.odwyer at gmail dot com @ 2021-03-17 16:21 ` redi at gcc dot gnu.org 2021-03-17 16:26 ` redi at gcc dot gnu.org 2 siblings, 0 replies; 3+ messages in thread From: redi at gcc dot gnu.org @ 2021-03-17 16:21 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=76262 --- Comment #6 from Jonathan Wakely <redi at gcc dot gnu.org> --- This behaviour is what the standard (still) requires. ^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug c++/76262] list-initialization prefers initializer_list over copy constructor [not found] <bug-76262-4@http.gcc.gnu.org/bugzilla/> 2021-03-17 14:10 ` [Bug c++/76262] list-initialization prefers initializer_list over copy constructor arthur.j.odwyer at gmail dot com 2021-03-17 16:21 ` redi at gcc dot gnu.org @ 2021-03-17 16:26 ` redi at gcc dot gnu.org 2 siblings, 0 replies; 3+ messages in thread From: redi at gcc dot gnu.org @ 2021-03-17 16:26 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=76262 Jonathan Wakely <redi at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- See Also| |https://gcc.gnu.org/bugzill | |a/show_bug.cgi?id=85577 --- Comment #7 from Jonathan Wakely <redi at gcc dot gnu.org> --- See Bug 85577 and it's duplicates too. ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-03-17 16:26 UTC | newest] Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- [not found] <bug-76262-4@http.gcc.gnu.org/bugzilla/> 2021-03-17 14:10 ` [Bug c++/76262] list-initialization prefers initializer_list over copy constructor arthur.j.odwyer at gmail dot com 2021-03-17 16:21 ` redi at gcc dot gnu.org 2021-03-17 16:26 ` redi at gcc dot gnu.org
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).