public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "paolo.carlini at oracle dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug libstdc++/53657] [C++11] pair(pair&&) move constructor is non-trivial
Date: Thu, 14 Jun 2012 09:41:00 -0000	[thread overview]
Message-ID: <bug-53657-4-k44gwAW4au@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-53657-4@http.gcc.gnu.org/bugzilla/>

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

Richard Guenther <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to work|                            |4.5.1, 4.6.0
   Target Milestone|---                         |4.7.2
            Summary|[C++11] pair(pair&&) move   |[4.7/4.8 Regression][C++11]
                   |constructor is non-trivial  |pair(pair&&) move
                   |                            |constructor is non-trivial
      Known to fail|                            |4.5.0

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to work|4.5.1, 4.6.0                |
   Target Milestone|4.7.2                       |---
            Summary|[4.7/4.8 Regression][C++11] |[C++11] pair(pair&&) move
                   |pair(pair&&) move           |constructor is non-trivial
                   |constructor is non-trivial  |
      Known to fail|4.5.0                       |

--- Comment #4 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-06-14 09:39:58 UTC ---
Thanks.

--- Comment #5 from Paolo Carlini <paolo.carlini at oracle dot com> 2012-06-14 09:40:44 UTC ---
The issue is related to LWG2005, and can be summarized with the following
testcase, which should not trigger the static_assert.

In short, if we want std::pair' move constructor defaulted, we have to use
std::is_constructible, not std::is_convertible, to constrain container::insert.

If people agree with my assessment - I don't see what else we could possibly do
on the library side - I can try again moving the latter to use
std::is_constructible, should mostly work.

/////////////////

#include <type_traits>
#include <utility>

struct move_only
{
  move_only(const move_only&) = delete;
  move_only(move_only&&) = default;
};

template<typename _T1, typename _T2>
 struct pair
 {
   pair(pair&&) = default;

   template<class _U1, class _U2>
     pair(pair<_U1, _U2>&& __p)
     : first(std::forward<_U1>(__p.first)),
       second(std::forward<_U2>(__p.second)) { }

   _T1 first;
   _T2 second;
 };

typedef pair<move_only, move_only> Pair;
typedef pair<const move_only, move_only> CPair;

static_assert(std::is_convertible<Pair, CPair>::value, "Error");
//static_assert(std::is_constructible<CPair, Pair&&>::value, "Error");


  parent reply	other threads:[~2012-06-14  9:41 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-13 14:53 [Bug libstdc++/53657] New: " redi at gcc dot gnu.org
2012-06-14  8:45 ` [Bug libstdc++/53657] " rguenth at gcc dot gnu.org
2012-06-14  9:15 ` redi at gcc dot gnu.org
2012-06-14  9:18 ` redi at gcc dot gnu.org
2012-06-14  9:40 ` [Bug libstdc++/53657] [4.7/4.8 Regression][C++11] " rguenth at gcc dot gnu.org
2012-06-14  9:41 ` paolo.carlini at oracle dot com [this message]
2012-06-14  9:44 ` [Bug libstdc++/53657] [C++11] " paolo.carlini at oracle dot com
2012-06-14 10:59 ` [Bug libstdc++/53657] [4.7/4.8 Regression] " redi at gcc dot gnu.org
2012-06-14 13:18 ` redi at gcc dot gnu.org
2012-06-19  9:31 ` paolo.carlini at oracle dot com
2012-06-20 15:05 ` paolo.carlini at oracle dot com
2012-06-20 15:11 ` daniel.kruegler at googlemail dot com
2012-06-20 15:16 ` paolo.carlini at oracle dot com
2012-06-20 15:21 ` redi at gcc dot gnu.org
2012-06-20 15:24 ` paolo.carlini at oracle dot com
2012-06-20 15:27 ` daniel.kruegler at googlemail dot com
2012-06-20 15:27 ` paolo.carlini at oracle dot com
2012-06-20 15:31 ` redi at gcc dot gnu.org
2012-07-13  9:05 ` paolo.carlini at oracle dot com
2012-07-13 12:39 ` bkoz at gcc dot gnu.org
2012-07-13 12:44 ` paolo.carlini at oracle dot com
2012-07-13 12:55 ` rguenther at suse dot de
2012-07-15 15:08 ` 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-53657-4-k44gwAW4au@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: link
Be 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).