public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/60584] New: std::vector::emplace_back(...) use move constructor
@ 2014-03-19 11:56 ruslan at mullakh dot com
  2014-03-19 11:57 ` [Bug c++/60584] " ruslan at mullakh dot com
  2014-03-19 13:34 ` [Bug libstdc++/60584] " redi at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: ruslan at mullakh dot com @ 2014-03-19 11:56 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 60584
           Summary: std::vector::emplace_back(...) use move constructor
           Product: gcc
           Version: 4.8.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ruslan at mullakh dot com

Created attachment 32390
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=32390&action=edit
sample code

the attached peace of code does not compile. complains on deleted move
constructor.

clang compile this sample, and as far as I understand standard it is valid
c++11.


build cmd:

g++-4.8 -std=c++11 /tmp/test.cpp


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

* [Bug c++/60584] std::vector::emplace_back(...) use move constructor
  2014-03-19 11:56 [Bug c++/60584] New: std::vector::emplace_back(...) use move constructor ruslan at mullakh dot com
@ 2014-03-19 11:57 ` ruslan at mullakh dot com
  2014-03-19 13:34 ` [Bug libstdc++/60584] " redi at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: ruslan at mullakh dot com @ 2014-03-19 11:57 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Ruslan Mullakhmetov <ruslan at mullakh dot com> ---
Created attachment 32391
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=32391&action=edit
compiler output


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

* [Bug libstdc++/60584] std::vector::emplace_back(...) use move constructor
  2014-03-19 11:56 [Bug c++/60584] New: std::vector::emplace_back(...) use move constructor ruslan at mullakh dot com
  2014-03-19 11:57 ` [Bug c++/60584] " ruslan at mullakh dot com
@ 2014-03-19 13:34 ` redi at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: redi at gcc dot gnu.org @ 2014-03-19 13:34 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
          Component|c++                         |libstdc++
         Resolution|---                         |INVALID

--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
I don't know what clang does to compile it, but the code is not valid.

vector<T>::emplace_back requires that T is MoveInsertable into the vector. Foo
fails that requirement because it has a deleted copy constructor and deleted
move constructor, because NonCopyable has a user-provided copy constructor
defined as deleted.

If you want NonCopyable to be movable then you need to do this:

class NonCopyable
{
public:
    NonCopyable(){}
    NonCopyable(const NonCopyable &) = delete;
    NonCopyable(NonCopyable &&) = default;
};

With that move constructor the code works.


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

end of thread, other threads:[~2014-03-19 13:34 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-03-19 11:56 [Bug c++/60584] New: std::vector::emplace_back(...) use move constructor ruslan at mullakh dot com
2014-03-19 11:57 ` [Bug c++/60584] " ruslan at mullakh dot com
2014-03-19 13:34 ` [Bug libstdc++/60584] " 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).