From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23613 invoked by alias); 8 Apr 2015 16:10:39 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 23573 invoked by uid 48); 8 Apr 2015 16:10:35 -0000 From: "redi at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/59969] std::pair nonstandard constructor interferes when calling map::emplace with noncopyable nonmovable object Date: Wed, 08 Apr 2015 16:10:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: libstdc++ X-Bugzilla-Version: 4.8.2 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: redi at gcc dot gnu.org X-Bugzilla-Status: RESOLVED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_status resolution Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2015-04/txt/msg00576.txt.bz2 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=59969 Jonathan Wakely changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED Resolution|--- |INVALID --- Comment #1 from Jonathan Wakely --- The attached example builds fine, I think you mean this: #include struct A { int bla; A(int blub):bla(blub){} A(A&&) = delete; A(const A&) = delete; A& operator=(A&&) = delete; A& operator=(const A&) = delete; }; int main() { std::map map; map.emplace(1, 1); } That code isn't valid. (In reply to gcc.gnu.org.49489419 from comment #0) > is preferred over the standard constructor > > template class = typename enable_if<__and_, > is_convertible<_U2, _T2> > >::value > >::type> > constexpr pair(_U1&& __x, _U2&& __y) > : first(std::forward<_U1>(__x)), second(std::forward<_U2>(__y)) { } That constructor isn't valid because is_convertible is false, because is_convertible is always false for non-movable types.