http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59969
Bug ID: 59969
Summary: std::pair nonstandard constructor interferes when
calling map::emplace with noncopyable nonmovable
object
Product: gcc
Version: 4.8.2
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: libstdc++
Assignee: unassigned at gcc dot gnu.org
Reporter: [email protected]
Created attachment 31968
--> http://gcc.gnu.org/bugzilla/attachment.cgi?id=31968&action=edit
example that cannot be built due to the bug
see also:
http://stackoverflow.com/questions/21405674/why-do-i-need-to-use-piecewise-construct-in-mapemplace-for-single-arg-construc
the issue is that on construction of the pair, the nonstandard constructor
// DR 811.
template<class _U1,
class = typename enable_if<is_convertible<_U1, _T1>::value>::type>
constexpr pair(_U1&& __x, const _T2& __y)
: first(std::forward<_U1>(__x)), second(__y) { }
is preferred over the standard constructor
template<class _U1, class _U2,
class = typename enable_if<__and_<is_convertible<_U1, _T1>,
is_convertible<_U2, _T2>
>::value
>::type>
constexpr pair(_U1&& __x, _U2&& __y)
: first(std::forward<_U1>(__x)), second(std::forward<_U2>(__y)) { }