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

           Summary: [C++0x] Defaulted vs declared move constructor vs
                    is_convertible
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassig...@gcc.gnu.org
        ReportedBy: paolo.carl...@oracle.com


I'm seeing the strange behavior summarized below, which prevents me from
implementing as-is the bit of N3140 about the defaulted move constructor.

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

#include <type_traits>

template<class _T1>
  struct pair
  {
    _T1 first;

    pair(const pair&) = default;
    pair(pair&&) = default;  // The static_assert triggers.
    // pair(pair&&);         // Works!                 

    template<class _U1>
      pair(pair<_U1>&&) { }
  };

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

template<typename _Key>
  class map
  {
    static_assert(std::is_convertible<pair<_Key>,
                              pair<const _Key>>::value, "");
  };

map<move_only> m;

Reply via email to