public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/46736] New: [c++0x] move constructor is not implicitly deleted when it should be
@ 2010-12-01  2:17 roman at binarylife dot net
  2010-12-01  9:27 ` [Bug c++/46736] " redi at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: roman at binarylife dot net @ 2010-12-01  2:17 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46736

           Summary: [c++0x] move constructor is not implicitly deleted
                    when it should be
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: roman@binarylife.net


$ cat test.cc 
struct U {
  U();
  U(U const&);
};

struct X {
  U const u;
  X();
  X(X&&);
};

X::X(X&&)=default;

X f() {
  return X();
}

$ g++ -c -std=c++0x test.cc; echo $?
0

If "=default" is inside the class, gcc properly emits an error.

Another one with the same issue:

$ cat test.cc 
#include <cstdlib>
#include <utility>

struct U {
  U() {}
  U(U const&) { abort(); }
};

struct X {
  U const u;
  X() : u() {}
  X(X&&);
};

X::X(X&&)=default;

int main() {
  X a;
  X b=std::move(a);
  return 0;
}

$ g++ -std=c++0x test.cc && ./a.out 
Aborted


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug c++/46736] [c++0x] move constructor is not implicitly deleted when it should be
  2010-12-01  2:17 [Bug c++/46736] New: [c++0x] move constructor is not implicitly deleted when it should be roman at binarylife dot net
@ 2010-12-01  9:27 ` redi at gcc dot gnu.org
  2010-12-08 20:00 ` jason at gcc dot gnu.org
  2010-12-10 21:36 ` jason at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: redi at gcc dot gnu.org @ 2010-12-01  9:27 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46736

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jason at gcc dot gnu.org

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> 2010-12-01 09:27:42 UTC ---
Jason, could you take a look?
Shouldn't a user-provided move constructor still be defined as deleted if
there's a subobject that isn't trivially copyable?


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug c++/46736] [c++0x] move constructor is not implicitly deleted when it should be
  2010-12-01  2:17 [Bug c++/46736] New: [c++0x] move constructor is not implicitly deleted when it should be roman at binarylife dot net
  2010-12-01  9:27 ` [Bug c++/46736] " redi at gcc dot gnu.org
@ 2010-12-08 20:00 ` jason at gcc dot gnu.org
  2010-12-10 21:36 ` jason at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: jason at gcc dot gnu.org @ 2010-12-08 20:00 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46736

--- Comment #2 from Jason Merrill <jason at gcc dot gnu.org> 2010-12-08 20:00:31 UTC ---
Author: jason
Date: Wed Dec  8 20:00:27 2010
New Revision: 167601

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=167601
Log:
    PR c++/46736
    * decl.c (cp_finish_decl): Complain about an implicitly deleted
    method defaulted outside the class.
    * method.c (maybe_explain_implicit_delete): Don't check DECL_INITIAL.

Added:
    trunk/gcc/testsuite/g++.dg/cpp0x/defaulted21.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/decl.c
    trunk/gcc/cp/method.c
    trunk/gcc/testsuite/ChangeLog


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug c++/46736] [c++0x] move constructor is not implicitly deleted when it should be
  2010-12-01  2:17 [Bug c++/46736] New: [c++0x] move constructor is not implicitly deleted when it should be roman at binarylife dot net
  2010-12-01  9:27 ` [Bug c++/46736] " redi at gcc dot gnu.org
  2010-12-08 20:00 ` jason at gcc dot gnu.org
@ 2010-12-10 21:36 ` jason at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: jason at gcc dot gnu.org @ 2010-12-10 21:36 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46736

Jason Merrill <jason at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |FIXED

--- Comment #3 from Jason Merrill <jason at gcc dot gnu.org> 2010-12-10 21:35:57 UTC ---
Fixed.


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-12-10 21:36 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-12-01  2:17 [Bug c++/46736] New: [c++0x] move constructor is not implicitly deleted when it should be roman at binarylife dot net
2010-12-01  9:27 ` [Bug c++/46736] " redi at gcc dot gnu.org
2010-12-08 20:00 ` jason at gcc dot gnu.org
2010-12-10 21:36 ` jason 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).