public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "daniel.kruegler at googlemail dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/55924] New: [C++11] Not all copy-assignment operator forms are correctly detected Date: Wed, 09 Jan 2013 18:28:00 -0000 [thread overview] Message-ID: <bug-55924-4@http.gcc.gnu.org/bugzilla/> (raw) http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55924 Bug #: 55924 Summary: [C++11] Not all copy-assignment operator forms are correctly detected Classification: Unclassified Product: gcc Version: 4.7.2 Status: UNCONFIRMED Severity: minor Priority: P3 Component: c++ AssignedTo: unassigned@gcc.gnu.org ReportedBy: daniel.kruegler@googlemail.com The following code, compiled with -Wall -std=c++11 -pedantic is rejected by gcc 4.7.2 and gcc 4.8.0 20130106 (experimental): //---------------- struct mine { mine& operator=(mine rhs) { return *this; } mine& operator=(mine&& rhs) noexcept { return *this; } }; int main() { mine a; mine b; a = b; } //---------------- "In function 'int main()':| 12|error: use of deleted function 'constexpr mine::mine(const mine&)'| 1|note: 'constexpr mine::mine(const mine&)' is implicitly declared as deleted because 'mine' declares a move constructor or move assignment operator| 3|error: initializing argument 1 of 'mine& mine::operator=(mine)'| " According to 12.8 p17: "A user-declared copy assignment operator X::operator= is a non-static non-template member function of class X with exactly one parameter of type X, X&, const X&, volatile X& or const volatile X&." and p18: "If the class definition does not explicitly declare a copy assignment operator, one is declared implicitly. If the class definition declares a move constructor or move assignment operator, the implicitly declared copy assignment operator is defined as deleted;" Therefore class mine provides a user-declared copy-assignment operator, but gcc doesn't recognize that. This code should be accepted. I reduced the severity, because this kind of code is expected to be a rather unusual edge-case. Every other form of the copy-assignment operator using references is correctly detected.
next reply other threads:[~2013-01-09 18:28 UTC|newest] Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top 2013-01-09 18:28 daniel.kruegler at googlemail dot com [this message] 2013-01-09 18:33 ` [Bug c++/55924] " daniel.kruegler at googlemail dot com 2013-01-09 18:40 ` redi at gcc dot gnu.org 2013-01-09 18:43 ` redi at gcc dot gnu.org 2013-01-09 18:44 ` daniel.kruegler at googlemail dot com 2013-01-09 19:04 ` redi at gcc dot gnu.org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-55924-4@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).