public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
* [Bug c++/55924] New: [C++11] Not all copy-assignment operator forms are correctly detected @ 2013-01-09 18:28 daniel.kruegler at googlemail dot com 2013-01-09 18:33 ` [Bug c++/55924] " daniel.kruegler at googlemail dot com ` (4 more replies) 0 siblings, 5 replies; 6+ messages in thread From: daniel.kruegler at googlemail dot com @ 2013-01-09 18:28 UTC (permalink / raw) To: gcc-bugs 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. ^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/55924] [C++11] Not all copy-assignment operator forms are correctly detected 2013-01-09 18:28 [Bug c++/55924] New: [C++11] Not all copy-assignment operator forms are correctly detected daniel.kruegler at googlemail dot com @ 2013-01-09 18:33 ` daniel.kruegler at googlemail dot com 2013-01-09 18:40 ` redi at gcc dot gnu.org ` (3 subsequent siblings) 4 siblings, 0 replies; 6+ messages in thread From: daniel.kruegler at googlemail dot com @ 2013-01-09 18:33 UTC (permalink / raw) To: gcc-bugs http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55924 --- Comment #1 from Daniel Krügler <daniel.kruegler at googlemail dot com> 2013-01-09 18:32:26 UTC --- Remark: The noexcept specifier was added unintentionally and is not relevant to reproduce the described problem. ^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/55924] [C++11] Not all copy-assignment operator forms are correctly detected 2013-01-09 18:28 [Bug c++/55924] New: [C++11] Not all copy-assignment operator forms are correctly detected daniel.kruegler at googlemail dot com 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 ` (2 subsequent siblings) 4 siblings, 0 replies; 6+ messages in thread From: redi at gcc dot gnu.org @ 2013-01-09 18:40 UTC (permalink / raw) To: gcc-bugs http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55924 Jonathan Wakely <redi at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Last reconfirmed| |2013-01-09 Ever Confirmed|0 |1 --- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> 2013-01-09 18:39:46 UTC --- Clang thinks you need to add mine() = default; mine(const mine&) = default; for the code to be accepted and I agree, otherwise the operator=(mine) assignment operator calls the copy constructor which is deleted because of a user-declared move assignment operator. ^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/55924] [C++11] Not all copy-assignment operator forms are correctly detected 2013-01-09 18:28 [Bug c++/55924] New: [C++11] Not all copy-assignment operator forms are correctly detected daniel.kruegler at googlemail dot com 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 4 siblings, 0 replies; 6+ messages in thread From: redi at gcc dot gnu.org @ 2013-01-09 18:43 UTC (permalink / raw) To: gcc-bugs http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55924 Jonathan Wakely <redi at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |UNCONFIRMED Ever Confirmed|1 |0 --- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> 2013-01-09 18:42:30 UTC --- Oops, I didn't meant to change this to NEW, sorry ^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/55924] [C++11] Not all copy-assignment operator forms are correctly detected 2013-01-09 18:28 [Bug c++/55924] New: [C++11] Not all copy-assignment operator forms are correctly detected daniel.kruegler at googlemail dot com ` (2 preceding siblings ...) 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 4 siblings, 0 replies; 6+ messages in thread From: daniel.kruegler at googlemail dot com @ 2013-01-09 18:44 UTC (permalink / raw) To: gcc-bugs http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55924 --- Comment #4 from Daniel Krügler <daniel.kruegler at googlemail dot com> 2013-01-09 18:43:52 UTC --- Oops I failed to read the error description correctly. The compiler is correct, so please declare this as INVALID. Sorry for the noise. ^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/55924] [C++11] Not all copy-assignment operator forms are correctly detected 2013-01-09 18:28 [Bug c++/55924] New: [C++11] Not all copy-assignment operator forms are correctly detected daniel.kruegler at googlemail dot com ` (3 preceding siblings ...) 2013-01-09 18:44 ` daniel.kruegler at googlemail dot com @ 2013-01-09 19:04 ` redi at gcc dot gnu.org 4 siblings, 0 replies; 6+ messages in thread From: redi at gcc dot gnu.org @ 2013-01-09 19:04 UTC (permalink / raw) To: gcc-bugs http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55924 Jonathan Wakely <redi at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED Resolution| |INVALID --- Comment #5 from Jonathan Wakely <redi at gcc dot gnu.org> 2013-01-09 19:04:13 UTC --- . ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2013-01-09 19:04 UTC | newest] Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2013-01-09 18:28 [Bug c++/55924] New: [C++11] Not all copy-assignment operator forms are correctly detected daniel.kruegler at googlemail dot com 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
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).